You can combine --git-dir and --work-tree to work with repos outside the current directory:
git --git-dir=/some/other/dir/.git --work-tree=/some/other/dir status
You can also set GIT_DIR as @opqdonut, but you also need to set GIT_WORK_TREE . Note that GIT_DIR is the path to the .git directory in the target repository, and GIT_WORK_TREE is the target repository.
This is all very convenient, but here is a shell function that will make your life easier:
function git-dir() { dir=$1 shift git --git-dir="$dir/.git" --work-tree="$dir" $* }
This will work in Bash or Zsh (and possibly other shells derived from Bourne). Put it in ~/.bashrc or ~/.zshrc or where appropriate for your environment.
Then you can simply do this:
git-dir /some/other/dir status
Where status is any Git command. It also works with other arguments that are passed directly to the git command:
git-dir /some/other/dir remote -v
source share