rebase - automatically continue if rerere resolved all conflicts

1.8k views Asked by At

Git rerere provides for reuse of previous conflict resolutions during rebase, and can even stage the resolved files by setting rerere.autoupdate = True (as detailed in another question). However, even if all conflicts are resolved and all files staged, I still have to run git rebase --continue to continue the rebase operation.

How can I automatically continue if rerere has resolved all conflicts and staged all changes?

2

There are 2 answers

0
fundoopanda On

No. Rebase or Merge does not automatically provide a provision for auto-commits when conflicts arise. You could understand more about git merge here in 'merging' heading. git config also does not provide an option for auto commits while rebasing. Note that you could choose not-to commit while merging.

1
VonC On

Rebase should use more the rerere-autoupdate from Git 2.14.x/2.15 onward (Q3 2017).

See commit f826fb7, commit 8d8cb4b, commit 6f0e577, commit 9b6d7a6, commit 5fb415b, commit fd4a3f4 (02 Aug 2017) by Phillip Wood (phillipwood).
(Merged by Junio C Hamano -- gitster -- in commit 1016495, 22 Aug 2017)

That is because now:

rebase: honor --rerere-autoupdate

Rebase accepts '--rerere-autoupdate' as an option but only honors it if '-m' is also given.
Fix it for a non-interactive rebase by passing on the option to 'git am' and 'git cherry-pick'.

rebase -i: honor --rerere-autoupdate

Interactive rebase was ignoring '--rerere-autoupdate'.
Fix this by reading it appropriate file when restoring the sequencer state for an interactive rebase and passing '--rerere-autoupdate' to merge and cherry-pick when rebasing with '--preserve-merges'.