我在 Xcode 项目的 git 中有很多 "Untracked Files"
I have tons of "Untracked Files" in git in Xcode project
我将 git 与 Xcode 一起使用,但是当我在提交并推送到远程后使用 Xcode(不是命令行)提交文件时,当我使用 git status
这是结果。
什么是Untracked Files
。我该怎么办?
Changes not staged for commit
部分呢?它们是什么?
这些未跟踪的文件是已添加到您的目录结构中的文件(例如,看起来您做了 pod install
),但您既没有将它们添加到源代码管理也没有告知 git忽略它们。 (我个人会告诉 git 忽略它们。)
但是您必须决定是要将 Pods
目录添加到您的存储库中还是要忽略它们。参见 https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control。 (我个人没有将 Pods
放入源代码管理,只是 Podfile
和 Podfile.lock
。不过,关于该主题有很多意见。)
关于 .DS_Store
,我们经常有一个 ~/.gitignore_global
告诉它也忽略那些。一旦你告诉它忽略这些,它们就会从“未跟踪”文件列表中删除。参见 .gitignore all the .DS_Store files in every folder and subfolder。
Re unstaged .DS_Store
看起来你的 repo 已经有一个 .DS_Store
在 repo 中。我建议将其从回购中删除。参见 How can I Remove .DS_Store files from a Git repository?。
简而言之,您的项目似乎没有 .gitignore
文件(或者缺少条目)。看起来你没有 ~/.gitignore_global
来忽略 .DS_Store
个文件。
有关可用于 Swift 项目的 .gitignore
的示例,请参阅 https://github.com/github/gitignore/blob/master/Swift.gitignore(不过,正如我所说,我通常会取消注释 Pods
来自那个特定的 .gitignore
).
我将 git 与 Xcode 一起使用,但是当我在提交并推送到远程后使用 Xcode(不是命令行)提交文件时,当我使用 git status
这是结果。
什么是Untracked Files
。我该怎么办?
Changes not staged for commit
部分呢?它们是什么?
这些未跟踪的文件是已添加到您的目录结构中的文件(例如,看起来您做了 pod install
),但您既没有将它们添加到源代码管理也没有告知 git忽略它们。 (我个人会告诉 git 忽略它们。)
但是您必须决定是要将 Pods
目录添加到您的存储库中还是要忽略它们。参见 https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control。 (我个人没有将 Pods
放入源代码管理,只是 Podfile
和 Podfile.lock
。不过,关于该主题有很多意见。)
关于 .DS_Store
,我们经常有一个 ~/.gitignore_global
告诉它也忽略那些。一旦你告诉它忽略这些,它们就会从“未跟踪”文件列表中删除。参见 .gitignore all the .DS_Store files in every folder and subfolder。
Re unstaged .DS_Store
看起来你的 repo 已经有一个 .DS_Store
在 repo 中。我建议将其从回购中删除。参见 How can I Remove .DS_Store files from a Git repository?。
简而言之,您的项目似乎没有 .gitignore
文件(或者缺少条目)。看起来你没有 ~/.gitignore_global
来忽略 .DS_Store
个文件。
有关可用于 Swift 项目的 .gitignore
的示例,请参阅 https://github.com/github/gitignore/blob/master/Swift.gitignore(不过,正如我所说,我通常会取消注释 Pods
来自那个特定的 .gitignore
).