Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitignore with platform specific defines?

I'm working on Fedora 22. When I perform a git status it lists all the *.o files. I don't recall seeing the behavior in the past.

I looked at the project's .gitginore file delivered via git clone, and it lacks a rule for *.o. I would like to add *.o, but I would like to do it for non-Windows platforms only. Windows uses *.obj, so its not needed. Plus, *.o is used for some programs on Windows (IIRC).

Is it possible to specify *.o for non-Windows platforms? If so, how?

like image 202
jww Avatar asked Dec 15 '25 08:12

jww


2 Answers

I did some research (one of the more definitive-looking sources was here), and it looks like .o files are not used for anything other than software development, where they are object files and should not be in version control.

So there isn't any reason to version .o files. Instead of trying to split the .gitignore file by platform, I would unconditionally ignore all .o files.

like image 103
Maximillian Laumeister Avatar answered Dec 16 '25 23:12

Maximillian Laumeister


Is it possible to specify *.o for non-Windows platforms? If so, how?

Yes. Put *.o in the personal excludes file for any non-Windows-platform userids that generate them as build detritus, or in the .git/info/exclude in any repo being used for work on one. I think the presumption is, people working on any platform with any development system and tools whatever know best what needs ignoring and what doesn't, and probably have those specified in their personal list rather than expecting projects everywhere to anticipate future toolchains.

like image 28
jthill Avatar answered Dec 16 '25 23:12

jthill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!