Skip to content

Instantly share code, notes, and snippets.

@alexleventer
Last active May 5, 2016 18:09
Show Gist options
  • Save alexleventer/4d03dd1748b9b0eb78dc88f024bb5ca4 to your computer and use it in GitHub Desktop.
Save alexleventer/4d03dd1748b9b0eb78dc88f024bb5ca4 to your computer and use it in GitHub Desktop.
How to delete all repo commit history

#How to delete all repo commit history

  1. Checkout git checkout --orphan latest_branch

  2. Add all files git add -A

  3. Commit the changes git commit -am "a commit message"

  4. Delete the branch git branch -D master

  5. Rename the branch to "master" git branch -m master

  6. 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