【问题标题】:What is git checkout -b <branchname> for? [duplicate]git checkout -b <branchname> 有什么用? [复制]
【发布时间】:2015-11-11 21:20:19
【问题描述】:

git checkout -b &lt;branchname&gt; 是什么?

我的意思是,你可以通过git branch &lt;branchname&gt;创建一个分支

但是,git checkout -b &lt;branchname&gt; 具体是做什么的?

【问题讨论】:

  • git checkout 文档中的快速引用:“指定 -b 会导致创建一个新分支,就像调用 git-branch 然后签出一样。”

标签: git


【解决方案1】:

这意味着你要做两件事:

  1. 创建一个新分支&lt;branchname&gt;
  2. 签出新分支&lt;branchname&gt;

它只是创建一个新分支然后直接检查它的简写。

$ git checkout -b new-feature

是以下的简写和等价物:

$ git branch new-feature
$ git checkout new-feature

参考请见documentation on git-branch

【讨论】:

  • @NietzscheProgrammer 不客气!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-12-20
  • 2020-03-05
  • 2018-08-31
  • 1970-01-01
  • 2021-08-03
  • 2018-11-23
  • 2018-04-22
相关资源
最近更新 更多