Interview Q&A / Git & GitHub
Git & GitHub interview questions
Branching, merge vs rebase, resolving conflicts and pull requests, the way teams actually work.
Prefer rapid revision? Practise Git & GitHub short interview answers →
- How do you undo the last commit but keep your changes?
Run git reset --soft HEAD~1 to keep the changes staged, or git reset HEAD~1 to keep them unstaged. The commit disappears from the branch while your work stays in the files.
BeginnerQuick answer1 min read - What is the difference between git reset --soft, --mixed and --hard?
All three move the branch to another commit. --soft keeps your changes staged, --mixed (the default) keeps them but unstaged, and --hard throws them away completely.
BeginnerQuick answer1 min read