Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save albertodebortoli/d4a254bfe959975ae95266b799c8bb7d to your computer and use it in GitHub Desktop.

Select an option

Save albertodebortoli/d4a254bfe959975ae95266b799c8bb7d to your computer and use it in GitHub Desktop.

Revisions

  1. albertodebortoli created this gist Jul 4, 2020.
    6 changes: 6 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    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