Reset repo history in Git



After doing a lot of pushed to a repo in github the cloning becomes slower and slower specially if you have images or media files that are generated everytime. Sometimes we don't actually care about the history of the repo, so thats what is this post about, deleting a repo's history. I use this for OnToology testing.


  1. Checkout
    git checkout --orphan latest_branch
  2. Add all the files
    git add -A
  3. Commit the changes
    git commit -am "commit message"
  4. Delete the branch
    git branch -D master
  5. Rename the current branch to master
    git branch -m master
  6. Finally, force update your repository
    git push -f origin master

If you have a better way, please do not hesitate to share it ;)

Resource: copied as is from: http://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github

Comments

Popular Posts