Search notes:

git rev-parse

Pick out and massage parameters.

Get a repository's latest commit ids

Latest commit id:
git rev-parse @
git rev-parse @~0
git rev-parse HEAD
2nd latest commit id:
git rev-parse @^
git rev-parse @~1
git rev-parse HEAD^1
3rd latest commit id:
git rev-parse @^^
git rev-parse @~2
git rev-parse HEAD^1^1

Determine interesting directories of a working directory

git rev-parse allows to determine some interesting directories of a working tree.

The .git directory

The .git directory can be determined as follows
git rev-parse --git-dir
git rev-parse --absolute-git-dir

The top level directory

git rev-parse --show-cdup
Returns »nothing« if already in the top level directory of a git repository. Otherwise, returns a relative path (typically something like ../../).

The objects directory

The objects directory can be found like so:
git rev-parse --git-path objects

See also

git commands

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759391085, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/version-control-systems/git/commands/rev-parse(81): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78