Created
December 1, 2014 20:26
-
-
Save kenny-evitt/8b1b1f905f5a07f016c9 to your computer and use it in GitHub Desktop.
Run Git command for all repositories in a directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ ! "$1" = "" ] ; then | |
if [ "$GITREPO" = "" -a -d "/c/@Kiln" ] ; then | |
GITREPO="/c/@Kiln" | |
fi | |
if [ "$GITREPO" != "" ] ; then | |
echo "Git repositories found in $GITREPO" | |
echo "-------" | |
DIRS="`/bin/ls -1 $GITREPO`" | |
for dir in $DIRS ; do | |
if [ -d $GITREPO/$dir/.git ] ; then | |
echo "$dir -> git $1" | |
cd $GITREPO/$dir ; git $@ | |
echo | |
fi | |
done | |
else | |
echo "Git repositories not found." | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I added the following to my .bashrc:
So I can run
argit branch
in the parent directory of my Git repo root directories (e.g. C:@kiln) to list all of the branches for all of my Git repos.