Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Twintails/18b75ad97c721f94ac43d94f801127e3 to your computer and use it in GitHub Desktop.
Save Twintails/18b75ad97c721f94ac43d94f801127e3 to your computer and use it in GitHub Desktop.
squash entire git history
# use at your own risk, might eat hamster and nose dragons
git branch -m master master-bak
git checkout --orphan master
git reset --hard
git commit --allow-empty -m 'init'
git merge --ff --squash --allow-unrelated-histories master-bak
git commit --amend
git push --set-upstream --force origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment