Last active
November 16, 2019 10:17
-
-
Save thanhtunguet/bac5a6b6fc21a6b0ada66cc7fee1e776 to your computer and use it in GitHub Desktop.
Git Sync
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 | |
function writeHR { | |
echo '---------------------' | |
} | |
function sync { | |
while read line | |
do | |
writeHR; | |
echo "Checking out $line"; | |
git checkout $line; | |
git pull $src $line; | |
git pull $dest $line; | |
git push $dest $line; | |
done; | |
} | |
cd $1; | |
echo "You are currently on `realpath .`" | |
src="$2"; | |
dest="$3"; | |
echo "Fetching remote: $src"; | |
git fetch $src; | |
echo "Fetching remote: $dest"; | |
git fetch $dest; | |
git branch -r | grep -v '\->' | grep $src/ | sed "s/$src\///g" | sync |
Author
thanhtunguet
commented
Nov 16, 2019
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment