What does rebase --onto let you do that a normal rebase cannot?

Last updated 6 July 2026

  • git rebase --onto <newbase> <upstream> <branch> separates where commits land (newbase) from which commits are moved (those after upstream up to branch).

  • A normal rebase replays everything since the upstream. --onto can transplant an arbitrary slice, such as moving a branch off the wrong parent while dropping intermediate commits.

  • https://www.freecodecamp.org/news/git-rebase-handbook/
  • https://thoughtbot.com/blog/rebasing-your-branch-with-git-rebase-onto
  • https://www.middle-engine.com/blog/posts/2020/04/25/rebasing-with-git-rebase-onto
  • https://git-scm.com/book/en/v2/Git-Branching-Rebasing
  • https://dev.to/delbetu/transplanting-git-branches-1glo
  • https://www.freecodecamp.org/chinese/news/git-rebase-handbook/
  • https://algomaster.io/learn/git/rebase-onto
All Git interview questions