【发布时间】:2017-04-08 08:16:34
【问题描述】:
我在我的项目中进行了一些更改,并在终端中使用 git status 命令检查了状态,以便在验证我更改的所有文件后提交更改。更改的文件都很好,但是它显示了一个文件的一些重复项。假设文件的名称是 xyz.swift。它显示如下输出:
On branch MyBranch
Untracked files:
(use "git add <file>..." to include in what will be committed)
root/Subroot/Core/xyz.swift 10.swift
root/Subroot/Core/xyz.swift 11.swift
root/Subroot/Core/xyz.swift 12.swift
root/Subroot/Core/xyz.swift 13.swift
root/Subroot/Core/xyz.swift 14.swift
root/Subroot/Core/xyz.swift 15.swift
root/Subroot/Core/xyz.swift 16.swift
root/Subroot/Core/xyz.swift 17.swift
root/Subroot/Core/xyz.swift 5.swift
root/Subroot/Core/xyz.swift 6.swift
root/Subroot/Core/xyz.swift 7.swift
root/Subroot/Core/xyz.swift 8.swift
root/Subroot/Core/xyz.swift 9.swift
nothing added to commit but untracked files present (use "git add" to track)
有人可以帮我解决这个问题吗?这种重复的数量不断增加。首先是 4 或 5 个文件。现在它显示了超过 25 个这样的文件。如果我使用 git add -u 这些文件不会被添加。但如果我做 git add .,它会创建重复项并添加到项目中。此外,在我的 XCode 项目中,只有一个 xyz.swift 是可见的。但是,不知何故,在终端中,它显示了这些奇怪的重复项。
非常感谢您的帮助。
提前致谢....祝您编码愉快。
【问题讨论】:
-
您是否从某个地方复制了文件?在 mac 中,当您复制文件时,如果文件名相同,您最终会出现重复。 Xcode 在将其添加到项目之前不会识别它们。
-
没有@GoodSp33d,我已经从远程存储库克隆了项目。