命令格式

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. Scala List的排序函数sortWith

    //原始方法: //val list=List("abc","bcd","cde") scala> list.sortWith( (s ...

  2. MSSQL索引优化

    转自:http://blog.itpub.net/16436858/viewspace-589275/ http://www.cnblogs.com/jams742003/archive/2011/1 ...

  3. webservice 缓存机制

    本文转载:http://blog.csdn.net/zhdd1234/article/details/4555472 WebService的缓存分为两种,一种是简单的输出缓存,一种是强大的数据缓存 一 ...

  4. PostgreSQL的 initdb 源代码分析之十五

    继续分析: if (pwprompt || pwfilename) get_set_pwd(); 由于我启动initdb的时候,没有设置口令相关的选项,故此略过. 接下来: setup_depend( ...

  5. phpStudy 2014的Apache虚拟主机配置

    安装phpStudy直接百度下载,傻瓜式安装很简单,一直点击下一步即可,中途根据个人爱好设置WWW目录,我的设置在D盘根目录里. 打开虚拟主机配置,打开D:\phpStudy\Apache\conf下 ...

  6. codeforces Gym 100500H H. ICPC Quest 水题

    Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/a ...

  7. BZOJ 2208: [Jsoi2010]连通数 tarjan bitset

    2208: [Jsoi2010]连通数 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/pr ...

  8. visual studio 2012进行C语言开发[图文]

    现在大家计算机大概都脱离XP了,so,之前蛮多可以用的编译器,可能放在我们现在的Win7,win8下面会出现一些比如不兼容了之类的问题.其实,用微软强大的IDE-visual studio系列,也是可 ...

  9. TreeView节点拖拉操作

    //这个拖拽的感觉不对     unit Unit1;interfaceuses  Windows, Messages, SysUtils, Classes, Graphics, Controls, ...

  10. 使用Active MQ在.net和java系统之间通信

    ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provider实现 一.特性列表 ⒈ 多种语言和 ...