I am going to go and answer, just to summarize the knowledge that I have on this subject. To some extent, I think this is an unresolved issue with git. The standard answer is "Do not check binary files and metadata in VCS", but sometimes the reality is that you need to share some information about the IDE / compilation configuration, but you need to support several compilers / OS / versions, etc.
Obviously .gitignore is useful for everything that really depends on the user or is generated by the compiler. You can find the best elements to ignore quite easily on your own, or you can browse the many available lists available on the Internet for different compilers and IDEs.
However, some files are necessary, but still depend on factors that vary from user to user or to machine. In my experience, the .vcxproj files .vcxproj the Visual Studio C project were criminals in this vein. The problem is that VS2010 and VS2012 want to use different versions of PlatformToolset . The solution was to use conditional operators:
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset> <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
I do not think this idea will work in your particular case, but it will probably work in many. For your situation, I think you need to decide what the "canonical" version will be (ie. Select the default compiler / IDE / version / machine / whatever), and then any situation that deviates from this should avoid checking of conflicting sections, The easiest way to do this is to use git add -p either in all of your changes, or just for files that are known to be problematic. Add only those parts that are useful to everyone, and for the rest, if they interfere with reinstallation or something else, you can either git stash them or explode them with git checkout -- <filename> after you have made important parts.
This question (or at least very similar) was also raised here , but at the time of writing the answer, one answer is not very useful. It may also have some relevant discussion, but again, the true solutions that relate to your problem are somewhat lacks.