diff options
Diffstat (limited to 'Documentation/git-rev-parse.txt')
-rw-r--r-- | Documentation/git-rev-parse.txt | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 5981c79f6a..5641d99518 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -52,6 +52,11 @@ OPTIONS The parameter given must be usable as a single, valid object name. Otherwise barf and abort. +-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. + --sq:: Usually the output is made one line per flag and parameter. This option makes output a single line, @@ -344,7 +349,7 @@ Each line of options has this format: * Use `*` to mean that this option should not be listed in the usage generated for the `-h` argument. It's shown for `--help-all` as - documented in linkgit:gitcli[5]. + documented in linkgit:gitcli[7]. * Use `!` to not make the corresponding negated long option available. @@ -375,6 +380,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 ------ |