Skip to content

Instantly share code, notes, and snippets.

@nickgrealy
Created February 15, 2017 13:03
Show Gist options
  • Save nickgrealy/3ad1d08a5efc4696a29c658f1842d89a to your computer and use it in GitHub Desktop.
Save nickgrealy/3ad1d08a5efc4696a29c658f1842d89a to your computer and use it in GitHub Desktop.
A git command for working with multiple subdirectories.
#!/bin/sh
#
# N.B. doesn't work for interactive scripts like "git diff" (instead use "git diff --exit-code").
#
# Perform git operation on all git directories...
/usr/bin/find . -name .git -prune -execdir bash -c "echo -e '\033[0;35m---------\033[0m'" \; -execdir pwd \; -execdir git "$@" \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment