Skip to content

Instantly share code, notes, and snippets.

@hxgdzyuyi
Last active March 1, 2018 05:47
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 hxgdzyuyi/90ff569ff0ac5f430114808cc049d081 to your computer and use it in GitHub Desktop.
Save hxgdzyuyi/90ff569ff0ac5f430114808cc049d081 to your computer and use it in GitHub Desktop.
#!/bin/bash
LAST_MERGE_COMMIT=`git log --grep="Merge branch" -1 --pretty=format:"%h"`
HEAD_COMMIT=`git show HEAD --summary --pretty=format:"%h"`
git reset --hard ${LAST_MERGE_COMMIT}
git pull upstream master
git cherry-pick ${LAST_MERGE_COMMIT}...${HEAD_COMMIT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment