-
-
Save dep-deprecated/6dcec9d63005009f21c05b900293d13b to your computer and use it in GitHub Desktop.
Merges master to a comma separated list of branches
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 | |
if [[ -z "$1" ]]; then | |
echo 'Merges master to branches' | |
echo 'mmt [branch],[branch],[branch]' | |
else | |
git fetch | |
IFS=', ' read -a array <<< "$1" | |
for((i=0;i<${#array[@]};i++)) | |
do | |
echo '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-' | |
git checkout ${array[i]} | |
git pull origin ${array[i]} | |
echo '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-' | |
git merge origin/master | |
echo '---' | |
read -p "Conflicts? Press CTRL-C to abort... Otherwise [Enter] to push ${array[i]} to origin" | |
git push origin ${array[i]} | |
echo '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-' | |
echo 'Moving on...' | |
done | |
echo 'Oh.. All done!' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment