4

I am trying to clean up a git repository by removing a number of files and folders with the easy to use BFG Repo-Cleaner. It removes the files and folders well (Thanks!) But the git log now has a number of commits with no file changes.

How can I also update the history so that commits made empty by file removal are removed?

Additional notes:

  • This is possible with the more awkward filter-branch approaches (e.g. this answer) with the --prune-empty option as described in github's how-to.
  • The approach of cleaning all empty commits (e.g. this answer) after the fact did't work well because: (a) there are some legitimate no-file commits in the repo left from old SVN tags, and (b) doing so also seems to strand some branches.
Community
  • 1
  • 1
Bryan P
  • 5,900
  • 5
  • 34
  • 49

0 Answers0