[英]“git branch --track” vs “git checkout --track”
“git branch --track”和“git checkout -b --track”有什么区别,如果有的话?
Internally git-branch
is called and then the new branch is checked out. 调用内部git-branch
,然后检出新分支。 From the docs . 来自文档 。
If -b is given, a new branch is created as if
git-branch
were called and then checked out; 如果给出-b,则创建一个新分支,就像调用git-branch
然后检出一样; in this case you can use the --track or --no-track options, which will be passed to git branch. 在这种情况下,您可以使用--track或--no-track选项,这些选项将传递给git branch。 As a convenience, --track without -b implies branch creation; 为方便起见,没有-b的--track意味着分支创建; see the description of --track below. 请参阅下面的--track说明。
如果我没有弄错, git checkout ...
实际上会创建分支并将你的工作副本切换到该分支,而git branch ...
将只创建分支并保留你的工作副本。
According to the documentation for git checkout
, there should be no difference. 根据git checkout
的文档,应该没有区别。
-b Create a new branch named <new_branch> and start it at <start_point>; -b创建一个名为<new_branch>的新分支,并在<start_point>处启动它; see git-branch(1) for details. 有关详细信息,请参阅git-branch(1)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.