Git merge的--rerere-autoupdate选项默认行为及配置问询
Git Merge中rerere-autoupdate的默认行为与配置
默认行为
执行git merge且未指定--rerere-autoupdate或--no-rerere-autoupdate时,默认行为等价于启用--rerere-autoupdate。也就是说,当rerere机制复用已记录的冲突解决方案更新工作树文件后,会自动将解决方案的结果同步更新至索引,无需手动执行git add暂存这些文件。
配置选项
该默认行为支持通过Git配置修改,对应配置项为rerere.autoupdate:
- 若想将默认行为改为
--no-rerere-autoupdate,可执行命令:# 全局生效 git config --global rerere.autoupdate false # 仅当前仓库生效 git config rerere.autoupdate false - 要恢复默认的自动更新索引行为,执行:
git config --global rerere.autoupdate true
补充说明
启用--no-rerere-autoupdate(或配置为false)时,rerere仅更新工作树文件,不会自动暂存到索引。你可以先检查冲突解决结果,确认无误后再手动执行git add,以此提前发现潜在的错误合并。
内容的提问来源于stack exchange,提问作者bern
相关产品推荐
相关产品推荐

