Krishna Krishna - 2 months ago 14
Git Question

Possible Ways to refer a commit

Would like to find different ways that we can refer for a commit in git. Could anyone please let me know what are the different ways that we can refer for a commit in git?

Answer

Here are some ways git refer a commit :

1) commits are referred as relative to one another. For instance HEAD~1 would refer to the commit parent of HEAD.
2) refspecs can be used to refer commits that reside on remote branches using local Git environment.
3) Every tags created in repository would become a ref, which Git would maintain certain commits alias's.
4) Git's commit hash can be used to refer corresponding commits.