Last active
February 7, 2022 11:08
-
-
Save Fedec96/26b382be831c2e6e34fe2f5de7f72b8a to your computer and use it in GitHub Desktop.
Reset the commit history for a repository
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
#!/bin/bash | |
# Make the current commit the only (initial) commit in the target repository. | |
git checkout --orphan newBranch | |
git add . | |
git commit -m "Initial commit" | |
git branch -D main | |
git branch -m main | |
git push -f origin main | |
git gc --aggressive --prune=all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment