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