Created
July 4, 2020 16:53
-
-
Save albertodebortoli/d4a254bfe959975ae95266b799c8bb7d to your computer and use it in GitHub Desktop.
Truncate git 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
https://stackoverflow.com/questions/41953300/how-to-delete-the-old-git-history | |
git checkout --orphan temp <f> # checkout to the status of the git repo at commit f; creating a branch named "temp" | |
git commit -m "new root commit" # create a new commit that is to be the new root commit | |
git rebase --onto temp <f> master # now rebase the part of history from <f> to master onthe temp branch | |
git branch -D temp # we don't need the temp branch anymore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment