我做了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
然后我意识到我不想{rep回复此档案push
:
project.xcworkspace/xcuserdata/M.xcuserdatad/WorkspaceSettings.xcsettings
所以在我做git push
之前我该怎样做才能停止提交这个特定文件(但不能将其从我的硬盘驱动器中删除)?
答案 0 :(得分:2)
你的问题有答案:
Changes to be committed: (use "git reset HEAD ..." to unstage)
要取消暂存文件,请输入:
git reset HEAD project.xcworkspace/xcuserdata/M.xcuserdatad/WorkspaceSettings.xcsettings
我可能会补充一点,这不会撤消您对文件所做的更改。