3

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?

jww
  • 97,681
  • 90
  • 411
  • 885
  • Which `.gitnignore` file were you looking at? – Tim Biegeleisen Jul 19 '15 at 01:31
  • Why do you want to version control `*.o` files on Windows? If these be artifacts of a build it seems these should be ignored. – Tim Biegeleisen Jul 19 '15 at 01:59
  • @Tim - Windows does not use `*.o` files as part of the build process, so its a non-sequitur. Plus, `*.o` is a valid file extension for other programs. For Windows, there is a rule for `*.obj` artifacts, so those temporary files are represented. – jww Jul 19 '15 at 02:03

2 Answers2

1

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.

Maximillian Laumeister
  • 19,884
  • 8
  • 59
  • 78
  • This is my feeling exactly and I also don't think there is any way to have a platform specific `.gitignore` file. – Tim Biegeleisen Jul 19 '15 at 02:11
  • @jww I appreciate the link, but shouldn't Stack Overflow foster the sharing of useful resolutions to a problem, even when they contradict the assumptions that the asker makes? – Maximillian Laumeister Jul 19 '15 at 02:18
  • @Maximillian - its not a useful solution. It merely provides your opinion on the matter. And its not like it occurred in a vacuum because I gave you the reason why. The assumption appears to be `*.o` files are temporary artifacts on Windows (which they are not - Windows uses `*.obj` files). The *"answer"* was probably better suited as a comment. – jww Jul 19 '15 at 02:24
  • @jww You suggested that `.o` files are used for some programs on Windows, and I cited a source that suggests that they aren't. If you or anyone else can find a program that generates and uses `.o` files other than for compiled code, then my answer will be incorrect. I'm sorry my answer was not helpful to you. – Maximillian Laumeister Jul 19 '15 at 02:32
1

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.

jthill
  • 55,082
  • 5
  • 77
  • 137
  • Thanks. Maybe this explains why I'm seeing the behavior on Fedora: `*.o` was previously in `.git/info/exclude`, but it got omitted in F22. There's probably a reason for it (like some program, like an Ogg derivative, began using the extension....). – jww Jul 19 '15 at 02:37