From, man git
:
You can do this with the --git-dir
parameter, before passing any commands.
git --git-dir /foo/bar/.git log
(Specifying the .git
directory is necessary.) From the documentation:
--git-dir=<path>
Set the path to the repository. This can also be controlled by setting the
GIT_DIR
environment variable. It can be an absolute path or relative path to current working directory.