![](/img/trans.png)
[英]can't checkout a git branch - need to commit changes, but no changes are present
[英]Git no changes to commit but can't switch branch
我在窗户上工作。 使用 Git 我试图切换到另一个本地分支,但由于这个错误它不会让我:
Your local changes to the following files would be overwritten by
checkout:
codelibrary/inc/variables.php
但是当我在当前分支上执行 git status 时,我得到:
nothing to commit, working tree clean
我在这些链接中看到了 2 个与我相同的问题:
但似乎没有一个答案能解决我的问题。
我怀疑我在当前分支中忽略了该文件,但在我想切换到的分支中没有。
我是 git 新手,所以我想请 git 专业人士帮我解决这个问题。
当您的路径中有一个未跟踪的文件在您尝试检出的分支中被跟踪时,就会发生这种情况。 Git 不知道如何处理这个文件(在已跟踪和未跟踪的文件之间使用哪一个,因此它拒绝检出分支。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.