Last active
April 3, 2022 01:26
-
-
Save szydan/75b8a03b3fb4e099d5c1 to your computer and use it in GitHub Desktop.
delete all commits from repo
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
git checkout --orphan latest_branch && \ | |
git add -A && \ | |
git commit -am "initial commit" && \ | |
git branch -D master && \ | |
git branch -m master && \ | |
git push -f origin master | |
Taken from | |
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 "initial commit" | |
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