Skip to content

Instantly share code, notes, and snippets.

@garryyao
Created March 12, 2012 15:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garryyao/2022634 to your computer and use it in GitHub Desktop.
Save garryyao/2022634 to your computer and use it in GitHub Desktop.
Git commands for rebase diverged remote branche without a merge.
#!/bin/sh
BRANCH=$1
git checkout $BRANCH
git fetch origin
git merge-base $BRANCH origin/$BRANCH | xargs git reset --hard
git merge origin/$BRANCH --ff-only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment