Last active
June 29, 2024 15:53
-
-
Save bbottema/4d6d799b9e2f018ad487df8c4a6973db to your computer and use it in GitHub Desktop.
Truncate GIT history
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
# <commit-rev> = commit you want to reset repo to | |
# <target-branch> = branch you want to truncate (probably master or develop) | |
git checkout --orphan temp <commit-rev> | |
git commit -m "Truncate history or Initial commit" | |
git rebase --onto temp <commit-rev> <target-branch> | |
git push --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment