So I tried to understand what tilde ~ symbol means in git and found a good article explains it.
git caret and tilde.
In short version, HEAD points to current commit, HEAD~1 points to one commit before(parent). HEAD~ is a shorthand for HEAD~1.
what the current commit is here?
Always HEAD points to the current commit.
If we have moved to the last but one commit isn't it the current commit?
Yes. Now HEAD points to the commit (which was last but one earlier)
It's like saying the current commit is the parent of itself.
No. Always HEAD~ points to the first parent commit.
The article explains the usage of ~ symbol a bit more.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
So I tried to understand what tilde ~ symbol means in git and found a good article explains it.
git caret and tilde.
In short version, HEAD points to current commit, HEAD~1 points to one commit before(parent). HEAD~ is a shorthand for HEAD~1.
Always HEAD points to the current commit.
Yes. Now HEAD points to the commit (which was last but one earlier)
No. Always HEAD~ points to the first parent commit.
The article explains the usage of ~ symbol a bit more.