zlacker

[parent] [thread] 3 comments
1. ptx+(OP)[view] [source] 2025-12-05 13:49:36
How? I tried recreating the scenario from the article (the section "First rebase –onto") and ran the first rebase with "--update-refs":

  $ git checkout feature-1
  $ git rebase --update-refs main
  Successfully rebased and updated refs/heads/feature-1.
  Updated the following refs with --update-refs:
   refs/heads/feature-2-base
But all it did was update feature-2-base. It still left feature-2 pointing to the old commits. So I guess it automates "git branch -f feature-2-base feature-1" (step 3), but it doesn't seem to automate "git rebase --onto feature-1 feature-2-base feature-2" (step 2).

Presumably I'm doing something wrong?

replies(2): >>happyt+z5 >>mhw+C5
2. happyt+z5[view] [source] 2025-12-05 14:17:09
>>ptx+(OP)
First, you don't need the extra "marker" commit. This flag obviates the entire workflow.

Second, you run it on the outermost branch: feature 2. It updates all refs in the chain.

3. mhw+C5[view] [source] 2025-12-05 14:17:17
>>ptx+(OP)
Yeah, you need to rebase the tip of the feature branch stack. git will then update all the refs that point to ancestor commits that are moved. So in this case

    $ git rebase --update-refs main feature-2
replies(1): >>ptx+eb
◧◩
4. ptx+eb[view] [source] [discussion] 2025-12-05 14:43:39
>>mhw+C5
Thanks! Yup, that does the trick.
[go to top]