Created
March 16, 2022 15:18
-
-
Save siwonpawel/9f0b86958ad3f57c44726b4770c50e98 to your computer and use it in GitHub Desktop.
Update all repos with bash
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 | |
for dir in */ ; do | |
cd $dir | |
pwd | |
echo "**** fetching all ****" | |
git fetch --all | |
echo "**** update master ****" | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
if [ "$branch" = "master" ]; then | |
git pull | |
else | |
git fetch origin master:master | |
fi | |
echo -e "\n\n****************************" | |
cd .. | |
done | |
echo -e "\n\n" | |
read -p "Press enter to close..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment