In our repository, we have two branches that have been diverging for some time now and I need to merge them back together. There will obviously be lots of conflicts, hopefully minor...
(foo )$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: some_commit1
Applying: some_commit2
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging some_file.xyz
CONFLICT (content): Merge conflict in some_file.xyz
Failed to merge in the changes.
Patch failed at 0002 some_commit2
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
I would like to somehow save the conflicts that need to be resolved and my resolutions of them, so that I could share them with the team as a code review so that we could ensure that everything was done correctly in the merge. Is there a good way to do that?
The stash entry is kept in case you need it again. There's no magic remedy for such merge conflicts. The only option for developers is to edit the file by hand and keep what they want and dispose of what they don't want. Once they merge and save the file, they will have effectively resolved the git stash conflict.
The status command is in frequent use when a working with Git and during a merge it will help identify conflicted files.
Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.
Take a look at git rerere. You may also want to see the SO question Sharing rerere cache.
After you resolve merge conflicts but before you commit your resolution, git rerere diff
will show you the resolution that will be recorded. Resolutions that have been committed are stored in .git/rr-cache
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With