Code

Merge branch 'maint'
[git.git] / Documentation / git-rev-parse.txt
index 5981c79f6a2568c33b455c649946d6af2d9baeb3..9e273bc5a6ee091ad7b81254228d33fd4df5541e 100644 (file)
@@ -52,6 +52,12 @@ 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,
@@ -114,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.
 
@@ -344,7 +353,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 +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
 ------
@@ -387,4 +421,4 @@ Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
 
 GIT
 ---
-Part of the linkgit:git[7] suite
+Part of the linkgit:git[1] suite