命令格式

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. java 2 8 10 16

    An integer literal may be expressed in decimal (base 10), hexadecimal (base 16), octal (base 8), or ...

  2. mybatis杂记

    mybatis学习官网: 1.如果项目中使用maven管理,又引用 了mybatis框架, 下面是mybatis官网给出的 mybatis在maven中央仓库的坐标原文 详情见连接:https://c ...

  3. cookie 编码问题

    问题描述:  Control character in cookie value or attribute. 解决方案: 1.前台编码 encodeURIComponent(str) 2.后台解码 原 ...

  4. Unity3D之游戏暂停制作方法记录

    在游戏开发中我们一般都需要涉及到一个功能:游戏暂停,但是这里指的暂停仅仅是核心模块的暂停,并不是整个游戏都暂停,比如一些UI和UI上的动画与特效是不能被暂停的,整个游戏都暂停了玩家该如何继续游戏呢. ...

  5. CloudStack 使用生态统计

    http://shapeblue.com/

  6. Klist

    显示当前缓存的 Kerberos 票证的列表. 有关如何使用此命令的示例 语法 klist [-<LogonId.HighPart> lh] [-li <LogonId.LowPar ...

  7. Codeforces Round #250 (Div. 1) A. The Child and Toy 水题

    A. The Child and Toy Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/438/ ...

  8. GLSL实现Ambient Occlusion 【转】

    http://blog.csdn.net/a3070173/archive/2008/11/04/3221181.aspx 相信使用OpenGl或DirectX3D的朋友都知道到固定功能管线在光照处理 ...

  9. phonegap 安装和使用eclipse

    1.下载nodejs...然后注销让nodejs可用 2.下载jdk,ant.和安卓的sdk. jdk是为ant编译时需要,设置JAVA_HOME环境变量 C:\Program Files\Java\ ...

  10. MySQL锁系列2 表锁

    http://www.cnblogs.com/xpchild/p/3789068.html   上一篇介绍了MySQL源码中保护内存结构或变量的锁,这里开始介绍下MySQL事务中的表锁. 注1: 在表 ...