Skip to content

Instantly share code, notes, and snippets.

@idkjs
Created January 17, 2021 16:05
Show Gist options
  • Save idkjs/c9844739ba84136a75cea5e25c684938 to your computer and use it in GitHub Desktop.
Save idkjs/c9844739ba84136a75cea5e25c684938 to your computer and use it in GitHub Desktop.
how-to-delete-all-commit-history-in-github
# https://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github#26000395
# echo Checkout
git checkout --orphan latest_branch
# echo Add all the files
git add -A
# echo Commit the changes
git commit -am "first commit"
# echo Delete the main branch
git branch -D main
# echo Rename the current branch to main
git branch -m main
# echo Finally, force update your repository
git push -f origin main
# echo PS: this will not keep your old commit history around
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment