Skip to content

Instantly share code, notes, and snippets.

@elton-fonseca
Created August 21, 2020 11:07
Show Gist options
  • Save elton-fonseca/e2295968eafd2569c759d872c12c0171 to your computer and use it in GitHub Desktop.
Save elton-fonseca/e2295968eafd2569c759d872c12c0171 to your computer and use it in GitHub Desktop.
How remove git history

How remove git history

First clone project with depth, where X is commit quantity:

git clone repository-path --depth x

After define de first commit in .git/info/grafts file:

echo "hash-commit" > .git/info/grafts

Then execute:

git filter-branch -- --all

git replace --convert-graft-file

Now you can add new origin e push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment