Hacker News new | ask | show | jobs
by porridgeraisin 31 days ago
> Then simply `git branch -f a-branch <logical same point on rebased>` for each of the others, done.

Yep, and after 2022 you can do this with --update-refs.

Situation 1: main has moved ahead, pull it and move whole stack (say feat1..N) on top of that

  git switch main
  git tag old main
  git pull --rebase
  git rebase --onto main old featN --update-refs
  nvim app/config.py # fix conflicts if necessary
  git add $_
  git rebase --continue
  git push origin feat{1..N}
Situation 2: adding a commit based on PR review on feat1

  git switch feat1
  nvim app/models.py
  git add app/models.py
  git commit -m 'make username unique'
  git rebase feat{1,N} --update-refs
  git push origin feat{1..N}
replace N above with how many ever PRs you have stacked