git -C

A Git option that runs the command as if you had first changed into the given directory.

In more detail

git -C work config user.email reads the setting of the repository in the work folder without leaving the one you are in. It is handy for scripts and for comparing two repositories side by side.

Example

git -C personal config --show-scope user.email

Related terms

Taught in

References