I understand that by default unless a previous commit is checked-out, HEAD
is the latest commit on the currently checked-out branch.
What is the difference between:
git reset HEAD
git reset HEAD~
My understanding:
The first command will reset latest commit - why would anyone do this? Unless for example HEAD
is made to point to another place using checkout command prior to running this reset command. Correct?
The second command will reset the commit prior to the head, effectively the latest commit will now be orphaned. Correct?