gpt4 book ai didi

由于已删除文件,无法进行 git merge

转载 作者:行者123 更新时间:2023-12-03 22:01:43 25 4
gpt4 key购买 nike

我解决了一个相当大的 merge 冲突。不过,我不能 promise 解决冲突。

当我想提交 git commit - m "Resolved conflicts" 时我收到这样的错误

error: Merging is not possible because you have unmerged files.



当我看 git status ,我可以看到在我的分支和 merge 的分支中,删除了一个文件 - git可以识别:

enter image description here

您可以在 both deleted 中看到这一点。符号。

我不能 - 按照建议 - 添加或删除文件。我收到文件丢失的错误。这是正确的,因为该文件已被删除,因此不在文件系统上。

有任何想法吗?

谢谢
罗恩

最佳答案

好的,终于有解决方案了!
你必须添加 每个删除的文件都带有 -u旗帜!

git add -u <file>
引用有关此标志的文档:

-u --update

Update the index just where it already has an entry matching . This removes as well as modifies index entries to match the working tree, but adds no new files.

If no is given when -u option is used, all tracked files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).


希望这可以帮助别人!

关于由于已删除文件,无法进行 git merge,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59373477/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com