Beginner LevelGit & GitHub
How does git cherry-pick apply specific commits from another branch?
❓ Interview Prompt: Explain git cherry-pick, selectively picking individual commits without merging entire branches, and handling cherry-pick conflicts.
git cherry-pick <commit-hash> applies the exact changes introduced by a specific commit from another branch onto your active branch, generating a brand new commit with a new SHA hash.
Code Implementation Example
bash
git log feature-branch --oneline -n 5
git switch main
git cherry-pick a1b2c3d💡Selective commit transplantation using git cherry-pick.
🎯 Interview Key Takeaway
Use git cherry-pick <hash> to copy individual commits from another branch without merging the whole branch.
#git cherry-pick#Commit Selection#Beginner
Back to all Git & GitHub Questions→