2

I use an HDL simulator which creates lots of large (hundred MB) binaries with seemingly random names -- these files do not have an extension. I'd like to keep these out of my Git repo.

I read on .gitignore without binary files a few techniques for ignoring files without extensions, but they're all pretty narrow in scope.

One of the challenges I face is that every time I run the simulator it generates new and randomly named binary outputs (e.g. it's unrealistic to manually add each one of these files to the ignore file).

Community
  • 1
  • 1
Doov
  • 863
  • 2
  • 12
  • 25
  • Could you put all these files in their own directory and `gitignore` the directory itself? – go-oleg Jul 03 '13 at 21:23
  • I thought about that -- the short answer is yes, but that would be a pain and would screw up the simulator. The simulator creates the files during use and needs them in the code directory. If I move them I'll screw up the simulator. Additionally it's kind of an annoying step to manually move each time I want to commit code. – Doov Jul 03 '13 at 21:41
  • 1
    I saw the suggestion to add the following lines: * !*.c on one post. Presumably I'd put in every file type I do want where the .c is. I guess that's an option, but not particularly robust. – Doov Jul 03 '13 at 21:44

1 Answers1

0

Perhaps you can set up a pre-commit hook to check file size before committing (assuming these binaries have some kind of base file size). Something like this would probably work, though I'm sure you'll want to play around with the max_file_size variable.

adamdunson
  • 2,635
  • 1
  • 23
  • 27
  • That's an interesting suggestion. I'm hesitant to do that for a few reasons. The first is that I have other files I do want in the repo that are of similar size to the files I don't want. The second is that I'd really rather keep the simulator output separate from my code. If worst comes to worst I'll try this, but I guess I'd rather avoid it if possible. – Doov Jul 03 '13 at 21:51
  • One thought to get around that is to set the hook up to ask "Y/n?" instead of failing immediately. Honestly, it might be better to just `git add` your files manually so that you're aware of exactly what's being committed. – adamdunson Jul 03 '13 at 22:00