Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource.Designer.cs under git

Tags:

I work in an environment where people use two different IDEs (Visual Studio and Xamarin Studio) to work on the same code. Unfortunately, they generate slightly different versions of the file Resource.Designer.cs. This is an auto-generated file but we do need it in VC, or the project will complain when you try to build it after cloning.

The problem here is that we do need this file in vc, BUT the tiny changes are highly annoying. If you commit the project with one IDE, then someone downloads the project into the other and rebuilds, you see a change to that file. Then if you try to switch branches, Git may refuse because of the merge conflict. Similarly, if you try to merge two branches, you are pretty much guaranteed to see a merge conflict in the header of that file.

The same problem occurs if two people build using the same IDE, but slightly different versions of the runtime. I am looking at an example right now with the following change showing in Git:

-  // Runtime Version: 4.0.30319.18444
+  // Runtime Version: 4.0.30319.34011

One fix that would solve the problem is, for this file only, to have Git always choose the "local" version of comments, and to ignore all changes to comments. But I don't know if there is a way to do that. If not, is there another way to avoid having constant hassles with small changes to this file?

like image 666
William Jockusch Avatar asked Mar 24 '14 20:03

William Jockusch


1 Answers

Our dev teams address this by committing the Resource.Designer.cs to our Git repo. After that, each developer can run git update-index --assume-unchanged Resource.Designer.cs to make Git ignore updates to that file.

After updating the index, changes made to the Resource.Designer file will not appear in the "Changes not staged for commit" section when doing a git status.

If a commit to that file becomes necessary just execute git update-index --no-assume-unchanged Resource.Designer.cs and Git will start tracking changes to that file again.

like image 187
benhorgen Avatar answered Sep 21 '22 05:09

benhorgen