git 由于未跟踪的工作树文件而失败
我不是谷歌专家。不用说,我什至不确定这意味着什么或如何解决?
>> git merge admin_playground
error: Untracked working tree file 'vendor/gems/panda-1.0.0/.gitignore' would be overwritten by merge.
fatal: merging of trees 538b2824765956cc44c42a8ad628e4f4 and d5d4cda68518cd1c81bf70ba8c339fea6 failed
我正在尝试执行 git merge 并得到这个失败的语句。
I'm not an expert at google. Needless to say, I'm not even sure what this means or how to resolve it?
>> git merge admin_playground
error: Untracked working tree file 'vendor/gems/panda-1.0.0/.gitignore' would be overwritten by merge.
fatal: merging of trees 538b2824765956cc44c42a8ad628e4f4 and d5d4cda68518cd1c81bf70ba8c339fea6 failed
I am trying to perform a git merge and getting this failing statement.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是因为
.gitignore
不在您当前的分支中(它未跟踪),但它在您尝试合并的分支中。添加有问题的 .gitignore 文件并提交,然后再次尝试合并;或者,如果您不需要并且对另一个分支中的文件感到满意,则删除 .gitignore 文件。It's because
.gitignore
isn't in your current branch (it's untracked), but it's in the branch you're trying to merge. Add the.gitignore
file in question and commit, then try the merge again; or delete the.gitignore
file if you don't need it and are happy with the one in the other branch.注意:mipadi(接受的答案)还在不同分支上的文件名之间的大小写冲突上下文中提到了此错误消息。
如果清理未跟踪的文件是一个有效的选项,那么这个答案中提到了极端的解决方案(
git clean -f -d
将删除所有未跟踪的文件和目录)。就你而言,这可能是矫枉过正(或危险)。
另一个原始解决方案< /a>:
注意:
git merge
上实际上没有“-f
”选项。Note: mipadi (author of the accepted answer) also mentioned this error message in the context of case conflicts between filenames on different branches.
If cleaning the untracked files is a valid option, then the extreme solution is mentioned in this answer (a
git clean -f -d
would remove all untracked files and directories).In your case, that could be overkill (or dangerous).
Another original solution:
Note: there is actually no '
-f
' option ongit merge
.尝试运行以下命令:
Try running below commands :