]> git.ipfire.org Git - thirdparty/git.git/commit - sequencer.h
rebase: add --update-refs option
authorDerrick Stolee <derrickstolee@github.com>
Tue, 19 Jul 2022 18:33:39 +0000 (18:33 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Jul 2022 19:49:04 +0000 (12:49 -0700)
commit900b50c242dfa6b47033cbb495d2fd9d06752ff1
treef1c4440f77ca55f9d476d17c8b8e126864ad5fa4
parenta97d79163e16e2d3777ab4d86c8f006f260c2836
rebase: add --update-refs option

When working on a large feature, it can be helpful to break that feature
into multiple smaller parts that become reviewed in sequence. During
development or during review, a change to one part of the feature could
affect multiple of these parts. An interactive rebase can help adjust
the multi-part "story" of the branch.

However, if there are branches tracking the different parts of the
feature, then rebasing the entire list of commits can create commits not
reachable from those "sub branches". It can take a manual step to update
those branches.

Add a new --update-refs option to 'git rebase -i' that adds 'update-ref
<ref>' steps to the todo file whenever a commit that is being rebased is
decorated with that <ref>. At the very end, the rebase process updates
all of the listed refs to the values stored during the rebase operation.

Be sure to iterate after any squashing or fixups are placed. Update the
branch only after those squashes and fixups are complete. This allows a
--fixup commit at the tip of the feature to apply correctly to the sub
branch, even if it is fixing up the most-recent commit in that part.

This change update the documentation and builtin to accept the
--update-refs option as well as updating the todo file with the
'update-ref' commands. Tests are added to ensure that these todo
commands are added in the correct locations.

This change does _not_ include the actual behavior of tracking the
updated refs and writing the new ref values at the end of the rebase
process. That is deferred to a later change.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-rebase.txt
builtin/rebase.c
sequencer.c
sequencer.h
t/t2407-worktree-heads.sh
t/t3404-rebase-interactive.sh