【发布时间】:2016-07-22 06:14:55
【问题描述】:
我做了git status,看到一堆新文件,例如:
要提交的更改: (使用“git reset HEAD ...”取消暂存)
new file: project/swiftFile1.swift
new file: projec/swiftFile2.swift
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: project.xcodeproj/project.pbxproj
modified: project.xcworkspace/xcuserdata/M.xcuserdatad/UserInterfaceState.xcuserstate
Untracked files:
(use "git add <file>..." to include in what will be committed)
project.xcworkspace/xcuserdata/M.xcuserdatad/WorkspaceSettings.xcsettings
我做了git add -A 并将上面的所有文件都添加到了 git 中,现在我看到了:
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: project.xcodeproj/project.pbxproj
modified: project.xcworkspace/xcuserdata/M.xcuserdatad/UserInterfaceState.xcuserstate
new file: project.xcworkspace/xcuserdata/M.xcuserdatad/WorkspaceSettings.xcsettings
modified: project/Base.lproj/Main.storyboard
modified: project/swiftFile1.swift
modified: project/swiftFile2.swift
然后我意识到我不想 push 到 repo 这个文件:
project.xcworkspace/xcuserdata/M.xcuserdatad/WorkspaceSettings.xcsettings
所以在我做git push 之前,我可以做些什么来停止提交这个特定的文件(但不要从我的硬盘中删除它)?
【问题讨论】:
标签: git