git -C

From wikieduonline
Jump to navigation Jump to search

git -C <path> run as if git was started in <path> instead of the current working directory.


Pull all repos in a path, including subdirectories:

  • find . -name ".git" -type d | sed 's/\/.git//' | parallel 'echo -e "\n=== {} ===" && git -C {} pull 2>&1'


  • Pull directories, not subdirectories:
ls -d */ | parallel git -C {} pull (assuming all sub-dirs are git repositories) [1]
ls -d */ | parallel git -C {} fetch
-C <PATH> run as if git was started in <path> instead of the current working directory


git fetch -C /path/to/git/folder

Errors[edit]


Related[edit]

See also[edit]

  • https://stackoverflow.com/a/33557279
  • Advertising: