GIT SHOW
Afficher le détail d’un commit :
git show SHA1
git show tagname
ex :
$ git show 089e7b1 commit 089e7b1961451999cf5120ab7d62dd80af072e4c Author: darwinosDate: Thu Jun 14 22:15:00 2018 +0200 Modif longueur.sh taille oneline diff --git a/longueur.sh b/longueur.sh index 20415af..9f87067 100644 --- a/longueur.sh +++ b/longueur.sh @@ -2,9 +2,7 @@ import sys -def taille(s) : - if not s : return 0 - return 1 + taille(s[1:]) +def taille(s) : return s and 1 + taille(s[1:]) or 0 for x in sys.argv[1:] : print(taille(x))
Pour afficher une version plus synthétique :
git show SHA1 --pretty=oneline
ex :
$ git show 089e7b1
commit 089e7b1961451999cf5120ab7d62dd80af072e4c Modif longueur.sh taille oneline
diff --git a/longueur.sh b/longueur.sh
index 20415af..9f87067 100644
--- a/longueur.sh
+++ b/longueur.sh
@@ -2,9 +2,7 @@
import sys
-def taille(s) :
- if not s : return 0
- return 1 + taille(s[1:])
+def taille(s) : return s and 1 + taille(s[1:]) or 0
for x in sys.argv[1:] :
print(taille(x))
Pour afficher une version formatée pour un email (envoyer un patch par exemple) :
git show SHA1 --pretty=email
ex :
$ git show 089e7b1
From 089e7b1961451999cf5120ab7d62dd80af072e4c Mon Sep 17 00:00:00 2001
From: darwinos <darwinos@example.com>
Date: Thu, 14 Jun 2018 22:15:00 +0200
Subject: [PATCH] Modif longueur.sh taille oneline
diff --git a/longueur.sh b/longueur.sh
index 20415af..9f87067 100644
--- a/longueur.sh
+++ b/longueur.sh
@@ -2,9 +2,7 @@
import sys
-def taille(s) :
- if not s : return 0
- return 1 + taille(s[1:])
+def taille(s) : return s and 1 + taille(s[1:]) or 0
for x in sys.argv[1:] :
print(taille(x))
Pour afficher le commit sur HEAD :
git show HEAD