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>
Christian Couder committed
May 13, 2008 at 06:51 UTC
824b5dc29cfe4f58d052d2d9273b39d34bf018e0
1 file changed
+25
Documentation/git-rev-parse.txt
+25
@@ -378,6 +378,31 @@ C? option C with an optional argument"
378
eval `echo "$OPTS_SPEC" | git-rev-parse --parseopt -- "$@" || echo exit $?`
379
------------
380
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
+
406
407
Author
408
------