1

So my Github repo contains many projects over the years, and now there are only a couple remaining. Is it possible to clean my commit history so that instead of thousands of commits about files/projects that no longer exist in this repo, down to maybe a hundred commits that pertain to the files in the couple of projects remaining. Thanks.

nismoh
  • 53
  • 1
  • 7
  • 3
    The answer to your question is "yes, use replace and filter-branch to construct any history you want from the history that's there now." Without a more specific question, it's going to be hard to provide a more specific answer. – jthill Sep 13 '20 at 22:57
  • Thanks jthill. I was able to resolve this using git filter-repo to filter out the projects that's no longer in the repo. – nismoh Sep 15 '20 at 17:49

1 Answers1

3

You can consider the new git filter-repo, which will replace the old git filter-branch or BFG.

It has many usage examples, inclusing path-based filtering:

To keep all files except these paths, just add --invert-paths:

git filter-repo --path README.md --path guides/ --path tools/releases --invert-paths
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250