Skip to content

Instantly share code, notes, and snippets.

@rudyhuynh
Last active October 4, 2018 13:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rudyhuynh/7dc060d970a0068ac66fb85a6b5704ba to your computer and use it in GitHub Desktop.
Save rudyhuynh/7dc060d970a0068ac66fb85a6b5704ba to your computer and use it in GitHub Desktop.

From this answer: https://stackoverflow.com/a/17141512/6307412

git checkout my-branch
git branch -m my-branch-old # this will rename 'my-branch' to 'my-branch-old'
git checkout master
git checkout -b my-branch
git merge --squash my-branch-old
git commit -m "...your message..."
git push origin my-branch --force # add --force to rewrite history on remote if neccessary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment