Skip to content

Commit 824b5dc

Browse files
chriscoolgitster
authored andcommitted
Documentation: rev-parse: add a few "--verify" and "--default" examples
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c3170a8 commit 824b5dc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Documentation/git-rev-parse.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,31 @@ C? option C with an optional argument"
378378
eval `echo "$OPTS_SPEC" | git-rev-parse --parseopt -- "$@" || echo exit $?`
379379
------------
380380

381+
EXAMPLES
382+
--------
383+
384+
* Print the object name of the current commit:
385+
+
386+
------------
387+
$ git rev-parse --verify HEAD
388+
------------
389+
390+
* Print the commit object name from the revision in the $REV shell variable:
391+
+
392+
------------
393+
$ git rev-parse --verify $REV
394+
------------
395+
+
396+
This will error out if $REV is empty or not a valid revision.
397+
398+
* Same as above:
399+
+
400+
------------
401+
$ git rev-parse --default master --verify $REV
402+
------------
403+
+
404+
but if $REV is empty, the commit object name from master will be printed.
405+
381406

382407
Author
383408
------

0 commit comments

Comments
 (0)