===== Overview =====
The ''git show'' command can show various types of objects in various formats:
* commits
* trees
* tags
* blobs
In addition, ''git show'' is used to show the state of repository contents as of a given commit, or even as it is in the index at the moment.
===== Showing a commit =====
==== The regular way ====
$ git show v4.12
tag v4.12
Tagger: Linus Torvalds
Date: Sun Jul 2 16:07:11 2017 -0700
Linux 4.12
-----BEGIN PGP SIGNATURE-----
iQEcBAABAgAGBQJZWXyfAAoJEHm+PkMAQRiGUSgH/36/pHSuUXjiwbeExWGl80tU
1sq62VBO2CUZdjgqxESdapRzmQZpiYJNfl5lo7p0UgW5GcSdxtB/9DXLJaIFu3z/
xB0i4OmZc6GX6hxY/Ve2ZbxjzMRyQYluzjbtT+mKrzkw6HWdxz19OAKpdDFqYoga
2TGerVSi2GHMe7N09T4fKIiRdfsmrj6AGPJ52t6w/Hv8SgxGv3yFHV0lPMgcwED9
Pmx8E/dU9wcXu5ou3gWwqxa5ODEjrgmDLD1g0+tFJVhHFszrhSmgqIteK478fPAs
cLfOo1AyzCQwqxhk34ppxmKheq6RRQzIynfd/bdmi/fWVwU9YlaTHixuc8pVViM=
=HBF4
-----END PGP SIGNATURE-----
commit 6f7da290413ba713f0cdd9ff1a2a9bb129ef4f6c
Author: Linus Torvalds
Date: Sun Jul 2 16:07:02 2017 -0700
Linux 4.12
diff --git a/Makefile b/Makefile
index 6d8a984..283c623 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
VERSION = 4
PATCHLEVEL = 12
SUBLEVEL = 0
-EXTRAVERSION = -rc7
+EXTRAVERSION =
NAME = Fearless Coyote
# *DOCUMENTATION*
$
==== The ''--stat'' way ====
$ git show --stat v4.12
tag v4.12
Tagger: Linus Torvalds
Date: Sun Jul 2 16:07:11 2017 -0700
Linux 4.12
-----BEGIN PGP SIGNATURE-----
iQEcBAABAgAGBQJZWXyfAAoJEHm+PkMAQRiGUSgH/36/pHSuUXjiwbeExWGl80tU
1sq62VBO2CUZdjgqxESdapRzmQZpiYJNfl5lo7p0UgW5GcSdxtB/9DXLJaIFu3z/
xB0i4OmZc6GX6hxY/Ve2ZbxjzMRyQYluzjbtT+mKrzkw6HWdxz19OAKpdDFqYoga
2TGerVSi2GHMe7N09T4fKIiRdfsmrj6AGPJ52t6w/Hv8SgxGv3yFHV0lPMgcwED9
Pmx8E/dU9wcXu5ou3gWwqxa5ODEjrgmDLD1g0+tFJVhHFszrhSmgqIteK478fPAs
cLfOo1AyzCQwqxhk34ppxmKheq6RRQzIynfd/bdmi/fWVwU9YlaTHixuc8pVViM=
=HBF4
-----END PGP SIGNATURE-----
commit 6f7da290413ba713f0cdd9ff1a2a9bb129ef4f6c
Author: Linus Torvalds
Date: Sun Jul 2 16:07:02 2017 -0700
Linux 4.12
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
$
==== Extremely concise ====
$ git show --oneline
15d8ffc96464 (HEAD) Merge tag 'mmc-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
$
===== Showing files =====
==== The general form ====
$ git show :
==== Showing some historical version of a file ====
Regardless of your current working directory, //show relative to the root of the repository//:
$ git show HEAD:Makefile
$ git show master:Makefile
$ git show topic:Makefile
$ git show v4.19:Makefile
$ git show 2241b8bcf2b5f1b01ebb1cbd1231bbbb72230064:Makefile
==== Showing a file in the current directory ====
You need to use the ''./'' syntax:
$ cd scripts/
$ git show HEAD:./Makefile
$ git show v4.19:./Makefile
==== Showing the staged version of a file ====
If you leave off the commit part, you're referring to the state of the file in the index:
$ git show :Makefile
$ git show :./Makefile