User Tools

Site Tools


git_show

This is an old revision of the document!


Overview

The git show command has a number of interesting variations.

Showing a commit

The regular way

$ git show v4.12
tag v4.12
Tagger: Linus Torvalds <torvalds@linux-foundation.org>
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 <torvalds@linux-foundation.org>
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 <torvalds@linux-foundation.org>
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 <torvalds@linux-foundation.org>
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 a file

Showing some version of a root directory file

Regardless of your current working directory:

$ git show HEAD:Makefile
$ git show master:Makefile
$ git show topic:Makefile
$ git show v4.12:Makefile

Showing a file in the current directory

$ git show HEAD:./Makefile
$ git show v4.12:./Makefile

Showing the staged version of a file

$ git show :Makefile
$ git show :./Makefile
git_show.1518351688.txt.gz · Last modified: 2018/02/11 12:21 by rpjday