Skip to content

Instantly share code, notes, and snippets.

@bartoszmajsak
Created May 2, 2012 17:53
Show Gist options
  • Save bartoszmajsak/2578690 to your computer and use it in GitHub Desktop.
Save bartoszmajsak/2578690 to your computer and use it in GitHub Desktop.
Synchronize with upstream
...
[alias]
synchronize-with-upstream = !~/synchronize-with-upstream.sh
...
#!/bin/sh
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "Branch should be provided as argument."
git checkout $1
git fetch upstream
git reset --hard upstream/$1
git push origin -f $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment