zlacker

[return to "Stacked Diffs with git rebase —onto"]
1. jbjbjb+kAe[view] [source] 2025-12-05 10:59:07
>>flexdi+(OP)
I think ‘git rebase —-update-refs’ is the better way to go for this scenario
◧◩
2. enbugg+mGe[view] [source] 2025-12-05 11:47:26
>>jbjbjb+kAe
Is there any good guide on how to solve the issue which OP solves?
◧◩◪
3. sirsuk+lKe[view] [source] 2025-12-05 12:15:59
>>enbugg+mGe
You don’t really need docs as --update-refs does what the OP does automatically instead of manually like the OP does.
◧◩◪◨
4. ptx+00f[view] [source] 2025-12-05 13:49:36
>>sirsuk+lKe
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?

[go to top]