gpt4 book ai didi

git - git rerere 是否自动将文件标记为已解决?

转载 作者:IT王子 更新时间:2023-10-29 01:27:40 29 4
gpt4 key购买 nike

我正在使用 git rerere,它很有用,但有一个问题:当它自动解析一个文件时,它不会将其标记为已解析(例如使用 git add)。因此,如果我运行“git mergetool”,它会打开文件,就好像它仍然包含所有冲突一样。

到目前为止,我已经制作了一个我可以调用的小 shell 脚本,它扫描所有标记为冲突的文件以查找冲突标记(例如 >>>>>>>),然后调用 git - 如果他们没有,请添加他们。

有更好的方法吗?我错过了一些 git rerere 标志?

最佳答案

也许是 git config设置可以帮助:

rerere.autoupdate

When set to true, git-rerere updates the index with the resulting contents after it cleanly resolves conflicts using previously recorded resolution.
Defaults to false.

注:从Git1.7.0开始,

"git rerere" had rerere.autoupdate configuration but there was no way to countermand it from the command line;
--no-rerere-autoupdate option given to "merge", "revert", etc. fixes this.


Git 2.38(2022 年第 3 季度)更新了关于“--[no-]rerere-autoupdate”选项的文档。

参见 commit cb54fc9 (2022 年 8 月 3 日)和 commit 0dbc715 (2022 年 7 月 15 日)Junio C Hamano (gitster) .
(由 Junio C Hamano -- gitster -- merge 于 commit 3adacc2 ,2022 年 8 月 14 日)

doc: clarify rerere-autoupdate

The "--[no-]rerere-autoupdate" option controls what happens after the rerere mechanism kicks in to reuse recorded resolutions and does not prevent from the rerere mechanism to trigger in the first place.

It is unclear in the current text if "--no-rerere-autoupdate" stops the auto-resolution.
Rewrite the sentence to clarify.

rerere-options 现在包含在其 man page 中:

After the rerere mechanism reuses a recorded resolution onthe current conflict to update the files in the workingtree, allow it to also update the index with the result ofresolution.

--no-rerere-autoupdate is a good way todouble-check what rerere did and catch potentialmismerges, before committing the result to the index with aseparate git add.

关于git - git rerere 是否自动将文件标记为已解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3283670/

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