Search code examples
objective-cxcodegitxcode5bitbucket

Should xcworkspace be in gitignore


I am using GitHubObjectiveCGitIgnore

When I go in sourcetree to commit I see :

project.xcworkspace

This file is not ignored using Github .gitignore file. I am not sure do I need to commit and push this file?


Solution

  • If you're using Cocoapods, I actually find that the answer depends on a few things.

    • If you just want the project to be compilable and runable "out of the box", then go ahead and check everything in; xcworkspace and all pods.
    • If there is a pod that you need to modify for some reason and you want to include that change with your project, then check everything in. For instance, I've found bugs that haven't been fixed for one reason or another and it was easier to just fix them myself and check in the pod along with my project rather than wait for the updated pod or integrating the library manually (which is essentially the same result as checking the pod in anyways). Alternatively, fork the repo, push your changes to it, and point your pod to your fork.
    • If you have no issues with any of the pods and you've verified that everything works with the versions of the pods you've specified, then you don't have to check in the xcworkspace file or pods. Of course, you'll have to run pod install in this case.

    There's no hard and fast rule on what to do here. Sometimes it's worth the extra overhead to just check everything in, and sometimes it's not necessary. It depends on what's most convenient for you.