I can create a repo and use GitHub / BitBucket fine for my own projects. I have had problems when collaborating with other developers or trying to fork a project on GitHub.
I am aware of other answers like Best practices for git repositories on open source projects but there are OSX / Xcode specific problems I want to know how to solve.
-
.DS_Store files can be a pain. You can use .gitignore to prevent, but what happens if they have already been included, or another developer adds them back in through a clumsy git command?
-
The .xcodeproj will have changes to the directory names and developer profiles for the other person. What’s the best way to do merges or to avoid conflicts?
-
If I have forked or pulled from a github project, how can I clean up these issues and also minimise merge conflicts for the maintainer?
If people have an example .gitignore created for Xcode, or scripts they use to initialise their repos then that would be great!
I’ll try one by one:
I. You need to use
git filter-branchonly if you need to remove the files from your history completely. If those files do not contain any credit card information, then i think the following should be enough:then add this file to
.gitignoreand commit it.This will commit the removal of the file from the repository but will keep the file in working directory. If you push it though and then somebody else will pull this commit, they might have their file removed, so you MUST communicate this.
By committing
.gitignoreyou will prevent other developers from adding this file again.If you’re not a maintainer, then i don’t think you should do anything, but address this issue to the maintainer.
II. I’m a strong believer that hidden files of any nature are most of the time not supposed to be put into the repository exactly for that reason. Therefore i think that you should do the same thing with .xcodeproj as with .DS_Store and put it into
.gitignoreand commit it..gitignoreis the exception for the rule above.III. If those files are properly ignored , then there will be no issues in future with them. If they are already in the repo and somebody wants do such cleanup it should be done by maintainer and communicated inside the team.
Hope that helps!