我必须提交合并才能让git-rerere记录我的冲突解决方案吗? [英] Do I have to commit a merge to make git-rerere record my conflict resolution?

查看:180
本文介绍了我必须提交合并才能让git-rerere记录我的冲突解决方案吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 git-rerere 用于其预期用途,以便在这些分支开发时逐步记录两个分支(主分支和主题分支)之间的冲突解决方案,而不创建不必要的合并提交。但是,即使阅读了git-rerere手册,我仍然不清楚何时rerere实际记录我的冲突解决方案。我用于检测和解决新合并冲突的标准工作流是从主题分支执行 git merge master ,解决冲突,然后放置所有文件并使用 git commit -m完成测试合并,然后使用 git reset --hard HEAD ^ 撤销合并,留下只有记录的分辨率由 git-rerere



存储。但是,这看起来有点愚蠢。创建一个提交,然后撤消它只是为了记录分辨率?在阅读 git-rerere 的手册页后,我在记录我的解决方案时仍不清楚。是否足够的只是阶段冲突的文件,或者我真的需要在解决冲突后创建合并提交,就像我一直在做的那样? 解决方案从手册页:

 在冲突的automerge 
后立即运行git rerere命令记录冲突的工作树文件与通常的冲突
标记<<<<<<<,====?>>>>>> >在他们中。稍后,在
完成解决冲突之后,再次运行git rerere会记录这些文件的
解析状态。

和:

 作为一种便利措施,git merge会在退出时使用失败的automerge自动调用git rerere 
,并且git rerere在新冲突时记录手b $ b解析,或者重新使用早先的解析
当它不是。当提交
合并结果时,git commit也会调用git rerere。这意味着你不必做任何特别的事情(除了启用rerere.enabled配置变量)。

所以你不必提交和撤销提交。你可以运行 git rerere 不带参数来记录提交。


I'm using git-rerere for its intended purpose, to record conflict resolutions between two branches (master and a topic branch) incrementally as those branches develop, without creating unnecessary merge commits. However, even after reading the git-rerere manpage I'm a little unclear on when rerere actually records my conflict resolution. My standard workflow for detecting and resolving new merge conflicts is to do git merge master from the topic branch, resolve the conflicts, then stage all the files and commit the merge with git commit -m "Finished test merge", and then undo the merge using git reset --hard HEAD^, leaving behind only the recorded resolutions stored by git-rerere.

However, this seems a bit silly. Creating a commit and then undoing it just to record the resolution? After reading the manpage for git-rerere, I'm still not really clear on when it records my resolutions. Is it sufficient to just stage the conflicted files or do I actually need to create the merge commit after resolving the conflicts, like I've been doing?

解决方案

From the manpage:

Running the git rerere command immediately after a conflicted automerge
records the conflicted working tree files, with the usual conflict
markers <<<<<<<, =======, and >>>>>>> in them. Later, after you are
done resolving the conflicts, running git rerere again will record the
resolved state of these files.

And:

As a convenience measure, git merge automatically invokes git rerere
upon exiting with a failed automerge and git rerere records the hand
resolve when it is a new conflict, or reuses the earlier hand resolve
when it is not. git commit also invokes git rerere when committing a
merge result. What this means is that you do not have to do anything
special yourself (besides enabling the rerere.enabled config variable).

So you don't have to commit and undo the commit. You can just run git rerere without parameters to record the commit.

这篇关于我必须提交合并才能让git-rerere记录我的冲突解决方案吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆