Search notes:

git rev-parse

Pick out and massage parameters.

Determine interesting directories of a working directory

git rev-parse allows to determine some interesing 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