Created
October 30, 2023 10:00
-
-
Save un4ckn0wl3z/af33c93c26dee5d6ec8bf70f8070ddb6 to your computer and use it in GitHub Desktop.
git.orphan
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
Deleting the .git folder may cause problems in your git repository. If you want to delete all your commit history but keep the code in its current state, it is very safe to do it as in the following: | |
Checkout | |
git checkout --orphan latest_branch | |
Add all the files | |
git add -A | |
Commit the changes | |
git commit -am "commit message" | |
Delete the branch | |
git branch -D main | |
Rename the current branch to main | |
git branch -m main | |
Finally, force update your repository | |
git push -f origin main | |
PS: this will not keep your old commit history around | |
ref: https://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment