X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=Documentation%2Fgit-rev-parse.txt;h=9e273bc5a6ee091ad7b81254228d33fd4df5541e;hb=8e69d78be3f315ea8c7b96400c0c65763b3e8f00;hp=b6b2fe92a15bcb3ea314e5411e957e41e67904d8;hpb=6d2c1c2dc064c40f6c723e0a25b5f813732fdaff;p=git.git diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index b6b2fe92a..9e273bc5a 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -52,7 +52,8 @@ OPTIONS The parameter given must be usable as a single, valid object name. Otherwise barf and abort. --q, --quiet:: +-q:: +--quiet:: Only meaningful in `--verify` mode. Do not output an error message if the first argument is not a valid object name; instead exit with non-zero status silently. @@ -119,16 +120,19 @@ OPTIONS --is-bare-repository:: When the repository is bare print "true", otherwise "false". ---short, --short=number:: +--short:: +--short=number:: Instead of outputting the full SHA1 values of object names try to abbreviate them to a shorter unique name. When no length is specified 7 is used. The minimum length is 4. ---since=datestring, --after=datestring:: +--since=datestring:: +--after=datestring:: Parses the date string, and outputs corresponding --max-age= parameter for git-rev-list command. ---until=datestring, --before=datestring:: +--until=datestring:: +--before=datestring:: Parses the date string, and outputs corresponding --min-age= parameter for git-rev-list command. @@ -243,16 +247,18 @@ Here is an illustration, by Jon Loeliger. Both commit nodes B and C are parents of commit node A. Parent commits are ordered left-to-right. - G H I J - \ / \ / - D E F - \ | / \ - \ | / | - \|/ | - B C - \ / - \ / - A +........................................ +G H I J + \ / \ / + D E F + \ | / \ + \ | / | + \|/ | + B C + \ / + \ / + A +........................................ A = = A^0 B = A^ = A^1 = A~1 @@ -378,6 +384,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 ------ @@ -390,4 +421,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite