Reset and Switch
What is HEAD
HEAD is a pointer that represents the current commit. It can be used as a commit id, and you can also refer to commits relative to HEAD. For example, using HEAD~X (like HEAD~1, HEAD~2...) lets you refer to X commits before HEAD.
You can see the <commit-id> where HEAD is with:
Switch to a commit (move HEAD + files)
Reset to a commit (move HEAD only)
For example, here is what you can do if you want to be in the exact same state your collegue was before pushing a commit bbbb on top of a commit aaaa, with his changes in the working tree:
Last updated