Abhishek Giradkar:
In the below git reset
command, the HEAD~3
is mentioned.
How is the numbering considered? And does it start from 0 or 1?
Al West:
In Git when you use the notation HEAD~3
, it means “3 commits before the current commit that HEAD is pointing to.”
HEAD~1
refers to the commit immediately before the latest commit, etc.
The numbering starts from 1 with HEAD~1
, not from 0. If you want to refer to the commit that HEAD currently points to, you’d simply use HEAD
- though HEAD~0
will work also.