Use git "log" from another folder

git

Solution

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.

Problem

I am in directory `A`. How do I execute `git log` for the git repository in directory `B`?

Original source

Related problems