Created
May 15, 2012 08:14
-
-
Save fbiville/2699951 to your computer and use it in GitHub Desktop.
Tiny snippet to update Git projects contained in the same directory.
This file contains hidden or 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/bash | |
| git_pull () { | |
| echo "" | |
| echo "## Updating $1 ##" | |
| echo "" | |
| cd $1 | |
| git pull | |
| cd - > /dev/null | |
| } | |
| if [ ! -d $1 ]; then | |
| echo "Please specify a valid parent directory of your projects." | |
| else | |
| for dir in `ls $1`; do | |
| complete_path="$1/$dir" | |
| if [ -d "$complete_path/.git" ] ; then | |
| git_pull $complete_path | |
| else | |
| echo "not git" | |
| fi | |
| done | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment