zoukankan      html  css  js  c++  java
  • git branch用法总结

    Git branch
       
       git branch 不带参数:列出本地已经存在的分支,并且在当前分支的前面加“*”号标记,例如:
       #git branch
    * master
       newbranch

       git branch -r 列出远程分支,例如:
       #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 列出本地分支和远程分支,例如:
       #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 创建一个新的本地分支,需要注意,此处只是创建分支,不进行分支切换,例如:
       #git branch newbranch2
       #git branch
       * master
       newbranch
       newbranch2
       当前的分支依然是master,不进行切换。

       git branch -m | -M oldbranch newbranch 重命名分支,如果newbranch名字分支已经存在,则需要使用-M强制重命名,否则,使用-m进行重命名。

       git branch -d | -D branchname 删除branchname分支

       git branch -d -r branchname 删除远程branchname分支


    例子:
    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      
       第三行符合git branch <branchname> [<start-point>]的格式,即以v2.6.14为start-point,创建新的本地分支branchname。

  • 相关阅读:
    Problem C: 爬楼梯
    Problem E: 倒水(Water)
    Problem H: tmk买礼物
    HDU 1078 FatMouse and Cheese
    POJ 3186 Treats for the Cows
    POJ 1661 Help Jimmy
    POJ 1458 Common Subsequence
    2018-软工机试-D-定西
    2018-软工机试-F-庙会
    2018-软工机试-C-和你在一起
  • 原文地址:https://www.cnblogs.com/cnundefined/p/7160944.html
Copyright © 2011-2022 走看看