简体   繁体   English

Git 结帐<branch_name>不管用</branch_name>

[英]Git checkout <branch_name> is not working

I am aware that git checkout -b "branch_name" will create a new branch and git checkout "branch_name" will switch to the specified branch我知道 git checkout -b "branch_name" 将创建一个新分支, git checkout "branch_name" 将切换到指定的分支

But when I unknowingly did git checkout branch_name (PS there is no quotes surrounding the branch_name) even though it said it is tracking the specified branch I was not able to see the branch level changes.但是,当我在不知不觉中执行 git 结帐分支名称(PS 分支名称周围没有引号)时,即使它说它正在跟踪指定的分支,我也无法看到分支级别的变化。

So are the double quotes mandatory for specifying the branch name during checkout?那么在结帐时指定分支名称是否必须使用双引号?

is the double quotes mandatory for specifying the branch name during checkout?结帐时指定分行名称时必须使用双引号吗?

No, " is not needed.不, "不是必需的。

From git checkout 's reference :来自git checkout参考

$ git checkout master

$ git checkout mytopic

I have never used quotes for checking out a git branch in 4 years of using git.在使用 git 的 4 年中,我从未使用引号来检查 git 分支。 That being said, you can also do, in case you have a reason for doing so.话虽如此,如果您有理由这样做,您也可以这样做。

git checkout \"branch_name\"
git checkout -b \"branch_name\" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 git checkout有什么区别 <branch_name> 和git checkout -b <branch_name> - Is there any difference between git checkout <branch_name> and git checkout -b <branch_name> `git branch -f之间的区别 <branch_name><hash> `和`git checkout <branch_name> ; git reset --hard <hash> `在干净的工作树下? - Difference between `git branch -f <branch_name> <hash>` and `git checkout <branch_name>; git reset --hard <hash>` under a clean working tree? 什么相当于LibGit2Sharp上的git checkout branch_name - What is equivalent of git checkout branch_name on LibGit2Sharp git中&#39;:&#39;的用法是什么 <branch_name> : <branch_name> - what is use of ':' in git <branch_name>:<branch_name> 当我运行 git checkout branch_name 时,Git 实际上做了什么? - What does Git actually do when I run git checkout branch_name? “$ git push”branch_name 的致命错误 - fatal error with “$ git push ”branch_name" Git致命:模糊参数&#39;branch_name&#39;:修订版和文件名 - Git fatal: ambiguous argument 'branch_name': both revision and filename git 日志:commit 是什么意思... → (origin/branch_name) ← - git log: what is meaning of commit ... → (origin/branch_name) ← git rebase branch_name 其更改位于顶部 - git rebase branch_name whose changes are on top Git意思是&#39;(Head - &gt; Branch_Name)&#39;和&#39;(master)&#39;在日志中 - Git meaning of '(Head -> Branch_Name)' and '(master)' in log
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM