0

I'm fairly familiar with GitHub and the process of commits/push/pull/etc. but I'm not sure what's the best approach to this issue, if there is one. I have a repo for a Unity project I worked on last fall for class and there's a lot of files in that repo that I do not wish to be seen in the commit history. For example, a ton of .meta files and other similar things that massively inflate the amount of files edited in each commit that make it very hard to find and view specifically the file changes I want to have visible (mainly everything in the Assets folder).

I have been told that the BFG Repo Cleaner could be handy here, and I've read up on the general process it follows and agree that it seems like a good choice here. However, most examples of commands I see with it relate to specific files, or files over a certain size, etc. whereas I have a very large amount of files, some large and some small, and in various directories, that I want removed from commit history.

What is the best way to go about achieving this goal, and is BFG the best thing to use for it? If it matters, I have already gone ahead and made a new commit that has only the files I want to keep, as a baseline for comparison.

  • I've used BFG a few months ago. I would say it's the best for your job (if you just want to delete not to migrate to git lfs). Well: Did you know you're able to use BFG with file extensions and even lists of file extensions? So just hand over all file extensions you want to delete to BFG. That's it. Guess the format was something like *.jpg,*.png. If you have any further problems let me know guess I've code examples somewhere laying around – Jan May 11 '18 at 10:44

1 Answers1

0

If you don't care about history, just squash the whole thing into a single commit in a new repo.

If you do care, BFG is your best bet. Note that you can delete by Git blob ID, which means that you can really do anything with enough scripting.

javabrett
  • 7,020
  • 4
  • 51
  • 73