命令格式

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. Light oj 1138 - Trailing Zeroes (III) (二分)

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1138 题目就是给你一个数表示N!结果后面的0的个数,然后让你求出最小的N. 我们可以知 ...

  2. 在线教育服务:http://www.ablesky.com/

    在线教育服务:http://www.ablesky.com/

  3. myeclipse内存配置

    配置文件路径:D:\work\myeclipse\MyEclipse for Spring 10\myeclipseforspring.ini 替换以下内容即可 -vmargs-Xmx768m-XX: ...

  4. Hadoop on Mac with IntelliJ IDEA - 4 制作jar包

    本文讲述使用IntelliJ IDEA打包Project的过程,即,打jar包. 环境:Mac OS X 10.9.5, IntelliJ IDEA 13.1.4, Hadoop 1.2.1 Hado ...

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

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

  6. BZOJ 2763: [JLOI2011]飞行路线 最短路

    2763: [JLOI2011]飞行路线 Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/pr ...

  7. 模拟TAB键

    模拟TAB键 (2013/6/7 22:35:29) SelectNext(ActiveControl,True,True); 屏蔽Alt+F4关闭键 (2013/6/7 22:35:39) 启动某些 ...

  8. Android多媒体数据库之MediaStore研究

    应网友要求,今天给大家讲android的多媒体数据库.MediaStore这个类是android系统提供的一个多媒体数据库,android 中多媒体信息都可以从这里提取.这个MediaStore包括了 ...

  9. SOA面向服务化编程架构(dubbo)

      dubbo 是阿里系的技术.并非淘宝系的技术啦,淘宝系的分布式服务治理框架式HSF啦 ,只闻其声,不能见其物.而dubbo是阿里开源的一个SOA服务治理解决方案,dubbo本身 集成了监控中心,注 ...

  10. yii泛域名

    return CMap::mergeArray( require (dirname(__FILE__) . '/main.php'), array( 'components' => array( ...