git -C

  • cd コマンドで移動しなくても、指定した別のディレクトリにいる体で git コマンドを実行できる
  • 実際のカレントディレクトリは移動しない
# -Cを使わない場合
cd /path/to/project
git status

# -Cを使った場合
git -C /path/to/project status