使用Xcode首选项与.gitignore文件 [英] Using Xcode preferences vs .gitignore file

查看:320
本文介绍了使用Xcode首选项与.gitignore文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是git存储库的新手,并且发现了对创建.gitignore文件的强大支持,该文件将放置在每个项目目录中.

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.

但是,我注意到git选项卡下源代码管理"下的Xcode 10首选项中有一个地方可以指定要忽略的文件.与.gitignore文件相比,在Xcode中定义排除项是否有优势?我似乎找不到任何实际以这种方式执行的操作,而且Apple文档很简单.

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?

谢谢!

推荐答案

我最好放些东西(也许是全球性物品)吗?

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

他们应该全部是全局变量.您可能没有理由在每个项目的每个项目中都拥有单独的.gitignore文件.您引用的Xcode 10首选项只是全局.gitignore文件的另一个窗口.毕竟,git是要忽略的,而不是Xcode.

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.

您的问题似乎暗示您未使用全局.gitignore文件.使用一个.我要做的是将此文件保存在主目录中,并将其命名为.gitglobalignores.该文件是通过.gitconfig文件指向的(对于如何安排这里).您是在文本编辑器中手动键入文件还是通过Xcode 10首选项窗口进行管理都无关紧要.

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.

这篇关于使用Xcode首选项与.gitignore文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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