Skip to content

Instantly share code, notes, and snippets.

@derek
Last active December 11, 2015 21:09
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 derek/4660453 to your computer and use it in GitHub Desktop.
Save derek/4660453 to your computer and use it in GitHub Desktop.
#!/bin/bash
function sync() {
BRANCH=$(parse_git_branch)
git fetch --all;
git checkout master && git merge upstream/master;
git checkout dev-master && git merge upstream/dev-master;
git checkout 3.x && git merge upstream/3.x;
git checkout dev-3.x && git merge upstream/dev-3.x;
git checkout live-docs && git merge upstream/live-docs;
git push --mirror origin;
git push --mirror origin;
git checkout $BRANCH;
}
function parse_git_branch (){
if git rev-parse --git-dir >/dev/null 2>&1
then
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
else
return 0
fi
echo $gitver
}
sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment