简体   繁体   中英

“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. From the docs .

If -b is given, a new branch is created as if git-branch were called and then checked out; in this case you can use the --track or --no-track options, which will be passed to git branch. As a convenience, --track without -b implies branch creation; see the description of --track below.

如果我没有弄错, git checkout ...实际上会创建分支并将你的工作副本切换到该分支,而git branch ...将只创建分支并保留你的工作副本。

According to the documentation for git checkout , there should be no difference.

-b Create a new branch named <new_branch> and start it at <start_point>; see git-branch(1) for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM