Skip to content

Instantly share code, notes, and snippets.

@paulbellamy
Created December 11, 2012 09:59
Show Gist options
  • Save paulbellamy/4257437 to your computer and use it in GitHub Desktop.
Save paulbellamy/4257437 to your computer and use it in GitHub Desktop.
git-sync
#!/bin/bash
current_branch=`git rev-parse --abbrev-ref HEAD`
if [ "$1" != "" ] && [ "$current_branch" != "$1" ]; then
# not syncing current branch
git fetch upstream && git push `whoami` upstream/$1:$1
else
git pull upstream $current_branch && git push -u `whoami` $current_branch
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment