1. Git to view your local branch:
: ~/mysite/* Master
2. View the remote branch:
: ~/mysite/mysite$ git branch-a* master remotes/origin/head-origin/Master Remotes/origin/Master remotes/origin/wyl
3. Create your own local branch:
: ~/mysite/mysite$ git branch luoting***:~/mysite/mysite$ git branch luoting* Master
4. Switch to the branch:
: ~/mysite/mysite$ git branch luoting* Master
5. Push to remote branch:
6. Delete local branch git branch-d xxxxx
: ~/mysite/mysite$ git branch luoting* master***:~/mysite/mysite$ git branch-D Luoting has deleted Branch luoting (formerly 5C404A4). ***:~/mysite/* Master
7. Use git to update remote to local :
The git fetch command is used when the remote host's repository is updated (git terminology is called commit) and needs to be retrieved locally.
$ git fetch < remote host name >
< remote host name > < branch name > For example, retrieving the master branch of the Origin host. $ git fetch the update retrieved by Origin master, which is read in the form of "remote hostname/branch name" on the local host. For example, the master of the origin host will be read with origin/master. The-r option of the git Branch command , which can be usedto view theremote Branch,--rorigin/-a* master remotes/ The origin/Master command indicates that the current branch of the local host is master and the remote Branch is Origin/master. After retrieving the updates from the remote host, you can create a new branch using the git Checkout command on its basis.
$ git checkout-b newbrach origin/master
The above command indicates that, on the basis of Origin/master, a new branch is created.
Alternatively, you can use the git merge command or the git rebase command to merge remote branches on the local branch.
$ git merge origin/master# or git rebase origin/master
The above command represents the merging of Origin/master on the current branch.
git Operation review: