Skip to content

Instantly share code, notes, and snippets.

@nfelger
Created July 19, 2011 10:16
Show Gist options
  • Save nfelger/1091907 to your computer and use it in GitHub Desktop.
Save nfelger/1091907 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Take the command to execute from the command line.
command=$@
# Default to updating the project if no command given.
[ -z "$command" ] && command='git pull --rebase ; git submodule init && git submodule update'
# Colors.
boldgreen=$(tput bold)$(tput setaf 2)
colorreset=$(tput sgr0)
for d in `ls`
do
if [[ -d $d/.git ]]
then
echo "In project $boldgreen$d$colorreset"
pushd $d > /dev/null
eval $command
popd > /dev/null
fi
done
@nfelger
Copy link
Author

nfelger commented Jul 19, 2011

Currently, updating all repos is the default, so, to get all the latest changes into your local repos, simply do:

    ./exec_in_all_projects

To get a compact status for all projects, I suggest a shortened format:

    ./exec_in_all_projects git status -sb

Of course any other command will work as well. Eval'ing user input like it's 1958.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment