GitHub (seven) - operation of the local and remote repository

1. push to a remote repository

    1.1 Adding a remote repository  (Origin alias as a remote repository)
        $ Git Remote [email protected] the Add Origin: GitHub-Book / Git-tutorial.git
    1.2 pushed to the remote repository
        1.2.1 pushed to the master branch
        $ git push -u origin master

         -u parameters may be pushed at the same time, the origin warehouse master branch of the current provided to the local repository branch upstream (upstream). Add this parameter, the future run git pull command to obtain content from a remote repository, the local branch of the warehouse can be directly from the origin of the master branch acquire content, eliminating the trouble of adding additional parameters

        1.2.2 pushed outside the master branch 

        $ git checkout -b other-branch


2. obtain from a remote repository

    Get Remote Warehouse 2.1

    $ git clone [email protected]:github-book/git-tutorial.git

    Execute git clone command we will be in default master the next branch, and the system will automatically origin set identifier for the remote repository. In other words, the current local warehouse master branch and GitHub end remote repository ( Origin ) of the master branch is identical in content.

    2.2 acquisition of remote branch

    $ git checkout -b feature-D origin/branchA

b behind parameter is the new branch in the local repository name. For ease of understanding, we will name it branchA , keep it the same name as the corresponding remote branch warehouse. Get behind the new branch name is derived from the name of the branch. Examples of specified origin / branchA , that is named in origin warehouse (referred to herein GitHub end warehouse) of branchA branch is created in the local repository source, branchA branch.

    2.3 Get the latest remote branch warehouse

    $ Git pull origin branchA







Guess you like

Origin blog.csdn.net/ly853602/article/details/80380438