On Thu, May 07, 2020 at 05:35:53PM +0530, Kunal Chauhan wrote: [...] > > Note that if you merely want to see whether a commit exists "as a user", > > just run > > > > git show <sha1_name> > > > > This command will either format you the message describing the commit > > and the diff of its changes or exit with an error message. > > > IF I give > git show ab49e09032ad like means to some initial commit id that I have > not whole SHA , then it will work.?
It's a bit more complicated: the syntax of the `git show` command calls its argument "a commit-ish", meaning that it may be anything which Git will creatively try to interpret as pointing at a commit. So, it can be the name of a branch (and then it will mean the tip commit of that branch), the name of a tag (and then it will mean the commit pointed to by the tag; if it points at a commit, of course, - tags can point at objects of any type), and finally it can be the SHA-1 name of a commit or an unambiguous prefix of such a SHA-1 name. To demonstrate on a live repository: $ git show ab fatal: ambiguous argument 'ab': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' $ git show ab4 fatal: ambiguous argument 'ab4': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' $ git show ab49 error: short SHA1 ab49 is ambiguous hint: The candidates are: hint: ab498291b commit 2019-03-13 - some commit message hint: ab49e0903 commit 2020-05-06 - another commit message hint: ab49436ed tree hint: ab49a5d6e tree fatal: ambiguous argument 'ab49': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' $ git show ab49e09032ad1fd40f0123f58a3d6c90ea451ec2 commit ab49e09032ad1fd40f0123f58a3d6c90ea451ec2 (HEAD, origin/master) Author: Konstantin Khomoutov <kos...@bsw...ru> Date: Wed May 6 21:23:43 2020 +0300 some commit message <…> -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/20200507124849.c233glyk3wflbsmn%40carbon.