Rebase, interactive rebase, cherry-pick, reset modes, revert, reflog, stash, bisect and amending commits.
40 cards · basic cards · AI-written, checked twice. Edit anything.
- What does git rebase do?
Show answer
Reapplies commits from one branch onto another branch, creating a linear history
- What command rebases your current branch onto another branch?
Show answer
git rebase <branch-name>
- What happens to commit hashes during a rebase?
Show answer
They change because each commit is reapplied with a new parent commit
- Why is rebasing already-pushed commits considered dangerous?
Show answer
Others may have based work on those commits, and rewriting history causes conflicts and confusion
- How does git rebase differ from git merge in the resulting history?
Show answer
Rebase creates a linear history; merge preserves both branches and creates a merge commit
- What is interactive rebase?
Show answer
A way to interactively modify, reorder, or squash commits before rebasing onto another branch
- What command starts an interactive rebase?
Show answer
git rebase -i <commit> or git rebase --interactive <commit>
- What does the pick action do in interactive rebase?
Show answer
Keeps the commit and applies it to the new base unchanged
- What does the reword action do in interactive rebase?
Show answer
Keeps the commit but opens an editor to change its commit message
- What does the squash action do in interactive rebase?
Show answer
Combines a commit with the previous one and prompts you to merge both commit messages
- What does the fixup action do in interactive rebase?
Show answer
Like squash, but automatically discards the commit's message and keeps only the previous one
- What is cherry-pick?
Show answer
Applying a specific commit from one branch onto your current branch
- What is the command to cherry-pick a single commit?
Show answer
git cherry-pick <commit-hash>
- Can you cherry-pick multiple commits at once?
Show answer
Yes, list multiple hashes separated by spaces: git cherry-pick <hash1> <hash2> <hash3>
- What does git cherry-pick --continue do?
Show answer
Resumes the cherry-pick operation after you have manually resolved merge conflicts