Git Branch Usage Summary

Source: Internet
Author: User

Git branch

Git branch takes no parameters: Lists the branches that already exist locally, and adds the "*" sign to the front of the current branch, for example:
#git Branch
* Master
Newbranch

git branch-r lists remote branches, for example:
#git Branch-r
M/master-origin_apps/m1_2.3.4
Origin_apps/hardware/test
Origin_apps/m1
origin_apps/m1_2.3.4
Origin_apps/master

git branch-a lists local and remote branches, such as:
#git branch-a
* Master
Newbranch
Remotes/m/master-origin_apps/m1_2.3.4
Remotes/origin_apps/hardware/test
Remotes/origin_apps/m1
remotes/origin_apps/m1_2.3.4
Remotes/origin_apps/master

Git branch creates a new local branch, and you need to be aware that this is just a branch, not a branch switch, for example:
#git Branch NEWBRANCH2
#git Branch
* Master
Newbranch
Newbranch2
The current branch is still master and does not switch.

git branch-m |-M oldbranch newbranch Rename the branch, if the Newbranch name branch already exists, you need to use-m to force the rename, otherwise, use-M to rename.

git branch-d |-d branchname Delete Branchname Branch

git branch-d-r branchname Remove remote Branchname Branch


Example:
An example of GIT help branch:
$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
$ CD my2.6
$ git Branch my2.6.14 v2.6.14
$ git checkout my2.6.14
The third line conforms to the GIT branch <branchname> [<start-point>] format, which is to create a new local branch branchname with v2.6.14 as Start-point.

Git Branch Usage Summary

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.