git Operation review:

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.