Naive Git 设置,是否可以取消跟踪 .gitignore 上列出的文件?
我在设置项目时犯了一个天真的错误。我们是 3 名开发人员,致力于一个远程存储库。在设置 git 时,我们从未想过 Xcode 会生成非开发文件并将它们推送到我们的远程存储库。现在,一旦我在崩溃和刻录之后了解到,我就制作了一个 .gitignore 文件。
.gitignore 看起来像这样,请告诉我是否也应该编辑它。 (文件信用也:这个问题的由 Abizem 给出的答案)
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
但是现在问题我是否有可能从我们的源代码管理中取消跟踪所有列出的文件?
或者
我可以列出所有跟踪的文件及其路径,后来我知道了一种痛苦的方法来逐个删除,
git rm --cached 'file path'
I have made a naive mistake while setting up my project. We are 3 developers working on one remote repository. While setting up git we never thought that Xcode would produce non-development files and push them to our remote repo. Now once I learnt after crash and burn I made a .gitignore
file.
.gitignore looks like this, please do let me know if I should edit this too. (File credit goes too : This question's answer given by Abizem)
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
But now question is there any possibilities that I can untrack all of those listed files from our source control?
or
Can I list all tracked files with their path and later I know a painful way to remove one by one with,
git rm --cached 'file path'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这些情况下,我做过几次,是将存储库中的所有文件移动到文件系统上的其他位置(除了 .gitignore),然后运行:
然后将文件添加回来并运行以下:
第二个添加 & commit 将遵循您的 gitignore 文件。
Something I've done a few times in these situations, is move all of the files in the repository somewhere else on the filesystem (except .gitignore), then run:
Then add your files back in and run the following:
This second add & commit will adhere to your gitignore file.