git 由于未跟踪的工作树文件而失败

发布于 2024-10-08 03:12:44 字数 342 浏览 0 评论 0原文

我不是谷歌专家。不用说,我什至不确定这意味着什么或如何解决?

>> 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

谢绝鈎搭 2024-10-15 03:12:44

这是因为 .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.

失去的东西太少 2024-10-15 03:12:44

注意:mipadi接受的答案)还在不同分支上的文件名之间的大小写冲突上下文中提到了此错误消息。

如果清理未跟踪的文件是一个有效的选项,那么这个答案中提到了极端的解决方案(git clean -f -d 将删除所有未跟踪的文件和目录)。
就你而言,这可能是矫枉过正(或危险)。

另一个原始解决方案< /a>:

git checkout -f admin_playground # will overwrite files
git checkout yourBranch # get back where you where when trying the merge
git merge admin_playground

这迫使 git 继续覆盖文件。
我假设您也可以将 '-f' 选项与 merge 一起使用,但是切换到另一个分支然后返回修复了问题,我能够在没有任何内容的情况下合并下次麻烦了。

注意: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:

git checkout -f admin_playground # will overwrite files
git checkout yourBranch # get back where you where when trying the merge
git merge admin_playground

This forced git to go ahead and overwrite the files.
I assume you could have used the '-f' option with merge also, but switching to the other branch and then back fixed the issue and I was able to merge without any trouble the next time.

Note: there is actually no '-f' option on git merge.

是你 2024-10-15 03:12:44

尝试运行以下命令:

git add *

git stash

git pull

Try running below commands :

git add *

git stash

git pull
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文