适用于多开发人员项目的Xcode + Git的最佳实践 [英] Best practices for Xcode + Git for multi-developer projects

查看:151
本文介绍了适用于多开发人员项目的Xcode + Git的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以创建一个repo,并使用Gi​​tHub / BitBucket来处理我自己的项目。与其他开发人员合作或尝试在GitHub上分发项目时遇到问题。



我知道其他答案,如开源项目中git仓库的最佳实践,但是我想知道如何解决OSX / Xcode特定的问题。


  1. .DS_Store 文件可能会很痛苦。您可以使用 .gitignore 来防止,但是如果已经包含它们,或者其他开发人员通过笨拙的git命令将它们添加回来,会发生什么情况?


  2. .xcodeproj 将对其他人的目录名称和开发人员配置文件进行更改。如果我从github项目中分离出来或从中拉出来的话,我该如何清理这些问题,以及如何解决这些问题。最小化维护人员的合并冲突? 如果有人为 .gitignore Xcode,或者他们用来初始化他们的仓库的脚本,那就太好了! 我会一个一个地尝试:

    / p>

    I。只有当您需要从历史记录中完全删除文件时,才需要使用 git filter-branch 。如果这些文件不包含任何信用卡信息,那么我认为以下内容应该足够了:

      git rm --cached。 DS_Store 
    git commit -m{Your message}

    然后将此文件添加到 .gitignore 并提交它。



    这将提交从存储库中删除文件,但会保留文件工作目录。如果你推它,然后别人会提交这个提交,他们可能会删除他们的文件,所以你必须通知这个。
    通过提交 .gitignore ,您将阻止其他开发者再次添加此文件。
    如果你不是维护者,那么我认为你不应该做任何事情,而是将这个问题提交给维护者。



    二。我坚信,任何性质的隐藏文件大部分时间都不应该因为这个原因而被放入存储库。因此,我认为您应该对 .xcodeproj 执行与 .DS_Store 相同的操作,并将其放入 .gitignore 并提交它。 .gitignore 是上述规则的例外。



    三。如果这些文件被正确忽略,那么将来就不会有任何问题。如果他们已经在回购中,并且有人想要进行这种清理,那么应该由维护者完成并在团队内进行沟通。



    希望有帮助!


    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.

    1. .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?

    2. 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?

    3. 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-branch only 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:

    git rm --cached .DS_Store
    git commit -m "{Your message}" 
    

    then add this file to .gitignore and 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 .gitignore you 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 .gitignore and commit it. .gitignore is 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!

    这篇关于适用于多开发人员项目的Xcode + Git的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆