Git and pbxproj

Viewed 22708

I was looking at an open source Mac application, and they gave some suggested values for .gitignore. They were what I would expect...

However, they also suggested an entry into a .gitattributes file:

*.pbxproj -crlf -diff -merge

I'm not the most knowledgable in terms of git, so I was wondering - what exactly are the benefits of adding this line? What does do in particular? I've only seen this suggested in this one project, and if it was normal practice I would have expected to see it elsewhere right now. So I was curious about how it applies to the pbxproj file specifically.

4 Answers

I faced the problem of corruption *.pbxproj file after resolving merge conflicts manually. Or, more often, my files just 'disappeared' from the working tree after the merge. It drove me mad because we work in a team, so you can imagine how messy it can become very fast.

So, I have tested merge=union and it works well so far. I know that it can't help if files were deleted or renamed at the same time, but for adding new files it works as expected: there is no conflicts and files don't disappear after the merge. And it also saves quite a bit of time.

If you want to try it out, here is what I did.

1) Create a global .gitattributes file. Run in terminal:

touch ~/.gitattributes
git config --global core.attributesfile ~/.gitattributes

2) This command should open it in a text editor:

open ~/.gitattributes

3) When the file opens, add this line and save the file:

*.pbxproj binary merge=union

Done. Hope this will help new readers like it helped me.

Related