Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hoangtrieukd/8f024324a8e8cfd4fcb08ebb2cb4ebed to your computer and use it in GitHub Desktop.
Save hoangtrieukd/8f024324a8e8cfd4fcb08ebb2cb4ebed 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