You cannot hide an uncommitted merge. Option 1 is immediately disconnected from the list.
For pure history, option 2 is better. Git has the ability to remember conflict resolution; it is disabled by default. You can enable it: git config --global rerere.enabled
. Resolve conflicts if necessary. Normally, you should do a merge, and Git will record a way to resolve conflicts. Since you really don't want to merge, you can simply run git rerere
to immediately record conflict resolution without committing. (Alternatively, if you went ahead and merged, you could just git reset --hard HEAD^
, rebooting to it. The resolution of the conflict is still remembered.)
Then you can fix the problem in branch A and repeat the merge. Git will re use re conflict conflict re . It will still be marked as unrelated, so you will have the opportunity to review it and make sure that it did the right thing before running git add
on unlinked tracks and fixing the merge.
And I do not quite understand option 3. Why do you need a cherry pick? It seems that foo.c
only breaks into branch A, into which you merge, so it will all be in branch A. The desired story is a mistake, followed by a merge; if you continue and merge instead, then fix the problem, you just switch the order of the two commits. In any case, it is not necessary to have recurring commits - I can help avoid this if you clarify!
source share