-
-
Save KonradIT/b90e51a7b524531d80164bfd762f4c2f to your computer and use it in GitHub Desktop.
Update all git repositories under a base 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/bash | |
# store the current dir | |
CUR_DIR=$(pwd) | |
echo "Pulling in latest changes for all repositories..." | |
for i in $(find . -name ".git" | cut -c 3-); do | |
echo ""; | |
echo "Current repository: $i"; | |
# We have to go to the .git parent directory to call the pull command | |
cd "$i"; | |
cd ..; | |
# finally pull | |
branch_git=$(git branch | grep \* | cut -d ' ' -f2) | |
git pull origin $branch_git; | |
# lets get back to the CUR_DIR | |
cd $CUR_DIR | |
done | |
echo "Complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment