Search code examples
gitmime-types

configure git ignore file to exclude files of certain mime-type


Would it be possible to configure git ignore for a particular mime-type? I am interested in configuring git ignore file to make it NOT pick up elf executable files.

Cheers.


Solution

  • Git ignore is based on recognising patterns in the filename.

    MIME types are determined by some metadata, for example the Content-Type header of an HTTP request. This metadata is not present in the filename alone, so I think there is no simple way to do what you are trying to achieve.

    The best you could do is ignore the known file types such as .axf, .bin, .elf, .o, .prx, .puff, .ko, .mod and .so (according to Wikipedia), but in the case of no file extension, I think your only options would be to ignore the entire output directory or known filenames.