Created
January 17, 2021 16:05
-
-
Save idkjs/c9844739ba84136a75cea5e25c684938 to your computer and use it in GitHub Desktop.
how-to-delete-all-commit-history-in-github
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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