|
|
|
|
|
by q3k
2595 days ago
|
|
HEAD~ means 'the second to last commit in the current branch' (ie. the second to last when you `git log`). git reset means 'point the current branch to this commit instead of wherver it's pointing now' (branches in git are just pointers to commits) git reset --hard means 'also reset the state of the checkout and staging area to be in sync with the commit' Thus, the entire spell means 'reset the current branch to make it point the the seecond-to-last-commit, also ensure my current checkout and staging area are in sync to that', or, in other words, fully forget and drop the latest commit. |
|
This seems like mistake or a non-standard usage of the english phrase "second to last". Given a git log of:
I would call "f82d1fd" the "next to last commit" and it can be referred to as HEAD~ I would call "9180c17" the "second to last commit" and it can be referred to as HEAD~2