From: Christian Couder Date: Tue, 13 May 2008 04:51:41 +0000 (+0200) Subject: Documentation: rev-parse: add a few "--verify" and "--default" examples X-Git-Tag: v1.5.6-rc0~38 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=824b5dc29cfe4f58d052d2d9273b39d34bf018e0;p=git.git Documentation: rev-parse: add a few "--verify" and "--default" examples Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index b6b2fe92a..69599ffb6 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -378,6 +378,31 @@ C? option C with an optional argument" eval `echo "$OPTS_SPEC" | git-rev-parse --parseopt -- "$@" || echo exit $?` ------------ +EXAMPLES +-------- + +* Print the object name of the current commit: ++ +------------ +$ git rev-parse --verify HEAD +------------ + +* Print the commit object name from the revision in the $REV shell variable: ++ +------------ +$ git rev-parse --verify $REV +------------ ++ +This will error out if $REV is empty or not a valid revision. + +* Same as above: ++ +------------ +$ git rev-parse --default master --verify $REV +------------ ++ +but if $REV is empty, the commit object name from master will be printed. + Author ------