Skip to content

Instantly share code, notes, and snippets.

@zamicol
Created December 18, 2020 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamicol/4461c5d6e925ddb80c22bce45e0f85e4 to your computer and use it in GitHub Desktop.
Save zamicol/4461c5d6e925ddb80c22bce45e0f85e4 to your computer and use it in GitHub Desktop.
Zamicol Git Sync Script
#!/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 git@github.com: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