Intermediate LevelGit & GitHub
How does git rebase --onto transplant a branch segment to a different base commit?
❓ Interview Prompt: Explain git rebase --onto <new-base> <old-base> <branch>, transplanting commit ranges, and untangling nested feature branches.
git rebase --onto <new-base> <old-base> <branch> transplants a series of commits off an old parent branch and grafts them directly onto a new base commit.
Code Implementation Example
bash
git rebase --onto main feature-A feature-B💡Transplanting branch segments cleanly using git rebase --onto.
🎯 Interview Key Takeaway
Use git rebase --onto <new-base> <old-base> to detach nested feature branch commits and reattach them to main.
#git rebase --onto#Branch Transplanting#Intermediate
Back to all Git & GitHub Questions→