QA
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→

More Git & GitHub Interview Questions

Beginner LevelGit & GitHub

Compare git rebase versus git merge and explain how git bisect finds regressions.

Beginner LevelGit & GitHub

What is the difference between git init and git clone?

Beginner LevelGit & GitHub

What are the Three Trees in Git (Working Directory, Staging Area / Index, Commit History)?