Search code examples
xcodegitgitignorepreferences

Using Xcode preferences vs .gitignore file


I'm new to git repositories and have found lots of great support for creating a .gitignore file that I would put in each project directory.

However, I've noticed that in Xcode 10 preferences under Source Control under the git tab there is a spot to specify files to ignore. Is there an advantage to defining the exclusions in Xcode versus the .gitignore file? I can't seem to find anyone that actually does it this way and Apple docs are light.

Are there some items (maybe globals) that I would put be better putting in prefs?

Thanks!


Solution

  • Are there some items (maybe globals) that I would put be better putting in prefs?

    They should all be globals. There is probably no reason for you to have individual .gitignore files on a project by project basis. The Xcode 10 preferences to which you refer is merely another window onto your global .gitignore file. It is, after all, git that is to do the ignoring — not Xcode.

    Your question seems to imply that you are not using a global .gitignore file. Use one. What I do is maintain this file in my home directory, and call it .gitglobalignores. The file is pointed to through the .gitconfig file (there's a good explanation of how to arrange that here). Whether you type out the file by hand in a text editor or manage it through the Xcode 10 preferences window doesn't matter.