命令格式

git branch [--color[=<when>] | --no-color] [-r | -a]
      [--list] [-v [--abbrev=<length> | --no-abbrev]]
      [--column[=<options>] | --no-column]
      [(--merged | --no-merged | --contains) [<commit>]] [<pattern>…​]

git branch [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>]

git branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]

git branch --unset-upstream [<branchname>]

git branch (-m | -M) [<oldbranch>] <newbranch>

git branch (-d | -D) [-r] <branchname>…​

git branch --edit-description [<branchname>]

命令参数

-d, --delete
  删除分支。

-D
  强制删除分支,--delete --force 的快照。

-m, --move
  移动或重命名分支及其 reflog。

-M
  强制移动或重命名分支,--move --force 的快照。

-r, --remotes
  列出或删除(带 -d 选项)远程追踪的分支。

-a, --all
  列出所有的远程分支与本地分支。

-v, -vv, --verbose
  详情模式。

-q, --quiet
  安静模式。

--merged [<commit>]
  合并指定的分支至当前分支。

实例

a) 列出所有本地分支

$ git branch

b) 列出所有远程分支

$ git branch -r

c) 列出所有本地分支和远程分支

$ git branch -a

d) 创建名为 dev 的分支

$ git branch dev

e) 创建名为 dev 的分支并切换到该分支

$ git checkout -b dev

f) 切换至 dev 分支

$ git checkout dev

g) 合并 dev 分支到当前分支

$ git merge dev

h) 删除 dev 分支

$ git branch -d dev

更多

http://git-scm.com/docs/git-branch

Git CMD - branch: List, create, or delete branches的更多相关文章

  1. git clone all branch and create a empty branch

    /******************************************************************** * git clone all branch and cre ...

  2. git branch & git remote branch

    git branch & git remote branch $ git branch -h usage: git branch [<options>] [-r | -a] [-- ...

  3. 要删除共享的初始登陆名 cmd下输入net use * /delete

    要删除共享的初始登陆名 cmd下输入net use *  /delete

  4. Git Your branch is ahead of 'origin/master' by X commits解决方法

    (1)方法1:git fetch origin (2)方法2(代码还需要):git push origin (3)方法3 (代码不需要):git reset --hard origin/$branch ...

  5. "sc.exe create/delete" - Create or Delete Services

    "sc.exe" can also be used to create and delete services. If you want to create a new servi ...

  6. git: Your branch and 'origin/master' have diverged

    git: Your branch and 'origin/master' have diverged - how to throw away local commits? - Stack Overfl ...

  7. Git master branch has no upstream branch的解决

    Git master branch has no upstream branch的解决 在push代码时,出现“git master branch has no upstream branch”问题的 ...

  8. Git GUI,Git Bash,Git CMD之间的区别

    Git GUI,Git Bash,Git CMD之间的区别 Git Bash: Bash,Unix shell的一种,Linux与Mac OS X v10.4都将它作为默认shell.Git Bash ...

  9. git error: unable to create file Invalid argument

    git error: unable to create file xxxx  Invalid argument 原因: mac  上创建的文件名里有冒号,这在windows 上是不允许的. 解决方式: ...

随机推荐

  1. Codeforces Round #352 (Div. 2) D. Robin Hood (二分答案)

    题目链接:http://codeforces.com/contest/672/problem/D 有n个人,k个操作,每个人有a[i]个物品,每次操作把最富的人那里拿一个物品给最穷的人,问你最后贫富差 ...

  2. linux(centos 6)下记录所有用户的操作以及ip、时间

    编辑/etc/profile文件,在文件末尾加入下面代码: [root@iZ23nn1p4mjZ root]# vi /etc/profile history USER=`whoami` USER_I ...

  3. cocos2d-x 缓动曲线

    转自:http://blog.csdn.net/cocos2der/article/details/7261808 在实现运动中,我们常常需要实现一些加速度或者减速度的效果,cocos2d-x引擎为我 ...

  4. contiki Makefile.include 四个关注点<contiki学习之二>

    Contiki Makefile.include 笔记 约定:  makefile 包括Makefile.Makefile.xxx,并不单指Makefile 不对makefile的语法进行分析,仅仅关 ...

  5. 【转】python的内存管理机制

    http://developer.51cto.com/art/201007/213585.htm 内存管理,对于Python这样的动态语言,是至关重要的一部分,它在很大程度上甚至决定了Python的执 ...

  6. JQuery Plugin 1 - Simple Plugin

    1. How do you write a plugin in jQuery? You can extend the existing jQuery object by writing either ...

  7. 取消掉Transfer-Encoding:chunked

    先说解决方法:::不让服务器返回Transfer-Encoding:chunked,在客户端请求的时候可以使用http 1.0的协议. 有时候,Web服务器生成HTTP Response是无法在Hea ...

  8. Seconds_Behind_Master

    http://blog.chinaunix.net/uid-28212952-id-3494560.html 今天同事遇到一个故障,xtrabackup备份中flush tables with rea ...

  9. Logistic回归总结

    原文:http://blog.csdn.net/dongtingzhizi/article/details/15962797  Logistic回归总结 作者:洞庭之子 微博:洞庭之子-Bing (2 ...

  10. oracle_partition sample_simple

    一:范围分区 就是根据数据库表中某一字段的值的范围来划分分区,例如: create table graderecord ( sno varchar2(10), sname varchar2(20), ...