-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Git 2.38 added the --update-refs
option to git rebase
.
For instance, assume following repository:
[feat1] [feat2] [feat3,HEAD]
F11 <- F12 <- F21 <- F22 <- F31 <- F32
|
v
C01 <- C02 <- C03
[main]
and we are on the feat3
branch.
If we run regular git rebase main
command, the result will be:
[feat1] [feat2]
F11 <- F12 <- F21 <- F22 <- F31 <- F32
|
v
C01 <- C02 <- C03
[main]
^
|
F11'<- F12'<- F21'<- F22'<- F31'<- F32'
[feat3,HEAD]
On the other hand, if we run new git rebase --update-refs main
command (new in Git 2.38), the result will be:
[feat1] [feat2] [feat3,HEAD]
F11'<- F12'<- F21'<- F22'<- F31'<- F32'
|
v
C01 <- C02 <- C03
[main]
As you notice, not just feat3
branch, intermediate references feat1
and feat2
are updated.
If we run the command git rebase -i --update-refs main
, the default git-rebase-todo
will look like this:
pick 8032d32f9d20 F11
pick 8a722d15209f F12
update-ref refs/heads/feat1
pick 632047524e9d F21
pick 16ed45fce9aa F22
update-ref refs/heads/feat2
pick 4c831d0f2851 F31
pick 0273bfae21d8 F32
Note that, git-rebase-todo
file will have some update-ref
lines by default, not just pick
s (when git rebase -i --update-refs
is run and a reference to update is found).
It would be nice if we can safely manage update-ref
lines (not to break intermediate references/checkpoints).
Some of my thoughts follow:
- Tier 1 (Interactive Rebase Editor)
- Able to display
update-ref
entries on the interactive rebase editor (just like other lines likepick
? or with a special appearance?) - Able to indirectly reorder
update-ref
entries (through reordering other lines)
- Able to display
- Tier 2 (Interactive Rebase Editor)
- Able to drop
update-ref
entries if necessary - Able to directly reorder
update-ref
entries
- Able to drop
- Tier 3 (Support with other UI elements / actions)