Skip to content

Instantly share code, notes, and snippets.

@i026e
Created January 12, 2017 08:36
Show Gist options
  • Save i026e/b3d34f2795e5abec3f0205d4d518dffe to your computer and use it in GitHub Desktop.
Save i026e/b3d34f2795e5abec3f0205d4d518dffe to your computer and use it in GitHub Desktop.
clear history
#! /usr/bin/env sh
#http://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github
#Checkout
git checkout --orphan latest_branch
#Add all the files
git add -A
#Commit the changes
git commit -am "clear history"
#Delete the branch
git branch -D master
#Rename the current branch to master
git branch -m master
#Finally, force update your repository
git push -f origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment