1

I have a C++ project that I am working on with several other people. Some of us have Macs with OSX and some of us have PCs with either Windows 7 or Windows 8.1. We are currently using eclipse to edit the project and git for version control.

The problem is that whenever you change property settings on one team member's computer the .cproject file is updated. Because different configurations/ file extensions are used across OSX and Windows we want the .cproject file to remain local.

We have tried untracking .cproject through a gitignore for the .cproject file, but that just removes the .cproject file from the repository all together. We have also tried setting up an assumed-unchanged for .cproject but if .cproject is changed all this leads to is the need to manually deal with conflicts and updates.

Is there any way to keep the file in the repository, but only change it locally? Ie merging would not update the .cproject file.

JBentley
  • 6,099
  • 5
  • 37
  • 72
Don't panic
  • 55
  • 1
  • 4
  • Does Eclipse not have a way to have different configurations within a project? If not, can't you just maintain two different versions of the .cproject file, one for each platform? – JBentley May 28 '14 at 02:26
  • Your build is a part of what should be version controlled, otherwise you have code which is out of sync with the build, so storing changes to the project only on local machines doesn't seem sensible. – JBentley May 28 '14 at 02:29

1 Answers1

0

You could consider a content filter driver, which would automatically, on git checkout,

  • take a .cproject.tpl file
  • take a script (the smudge script) able to:
    • recognize the content of that template file
    • recognize the environment (OS) or access a local private file
    • generate a private (not versioned) .cproject file (it can even combine it with a file with private values, maintained by the developer, and suited for the local environment)

smudge

(Picture from "Customizing Git Attributes" from the Git Book)

Note that may not be fully supported in EGit/JGit (which has still issue with smudge/clean filters)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250