gpt4 book ai didi

git undo merge and add for 单个文件

转载 作者:太空狗 更新时间:2023-10-29 14:28:54 26 4
gpt4 key购买 nike

merge 分支后我遇到了一些 merge 冲突。

我修复了它们,对于我修复的每个文件,我都使用 git add 将其添加到 merge 提交中。

如果我稍后通过运行代码意识到 merge 是错误的,我怎么能撤消其中一个文件的 git add 呢?所有这些提交任何内容之前,文件仍然被添加、修改和未提交。

最佳答案

I would like to have again the conflict in that file, to reset it somehow, to have <<<<<<< and >>>>>

您可以 restore the merge conflict markers在您的工作目录中使用 --conflict git-checkout 的选项:

git checkout --conflict=merge -- path/to/file

来自documentation :

This will re-checkout the file again and replace the merge conflict markers. This can be useful if you want to reset the markers and try to resolve them again.

关于git undo merge and add for 单个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50922675/

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