Created
December 18, 2020 19:40
-
-
Save zamicol/4461c5d6e925ddb80c22bce45e0f85e4 to your computer and use it in GitHub Desktop.
Zamicol Git Sync Script
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
#!/usr/bin/env bash | |
pwd=$(pwd) | |
mkdir -p $ZAMICOL | |
cd $ZAMICOL | |
# Main Repos | |
PROJ="zamicol jsonflag style gitversion baseconverter pueblomakes.com " | |
# Extras | |
PROJ="$PROJ httprouter_example allyoucan isaidbefore genetics medical InternetCitizenBillOfRights" | |
# Old | |
PROJ="$PROJ Pass_Gallery_Downloader xtender-xtractor" | |
for dir in $PROJ; do | |
mkdir -p $dir | |
git clone [email protected]:zamicol/$dir.git | |
done | |
read -p "Pull? " -n 1 -r | |
if ! [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
exit 0; | |
fi | |
echo "Pulling: "; | |
for dir in $PROJ; do | |
cd $ZAMICOL/$dir | |
git pull origin master | |
done | |
read -p "Push? " -n 1 -r | |
if ! [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
exit 0; | |
fi | |
echo "Pushing: "; | |
for dir in $PROJ; do | |
cd $ZAMICOL/$dir | |
echo "Pushing $dir" | |
git add . | |
git commit -a -m 'commit pushed by sync script' | |
git push | |
done | |
printf "\n\nChange back to original directory $pwd\n" | |
cd $pwd | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment