Last active
December 3, 2021 19:56
-
-
Save mscribellito/470f67e0788cee8e7eed42d1864dbf59 to your computer and use it in GitHub Desktop.
Delete Git commit history
This file contains hidden or 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
# Create orphan branch | |
git checkout --orphan temp_branch | |
# Add files to branch | |
git add -A | |
git commit -am "First commit" | |
# Delete main branch | |
git branch -D main | |
# Rename current branch | |
git branch -m main | |
# Push changes | |
git push -f origin main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment