.gitignore与iOS项目无法正常工作

bru*_*uno 0 git github

这种情况正在发生,我无法理解为什么

User-MBP:Project user$ git status
On branch playlist
Your branch is ahead of 'origin/playlist' by 1 commit.
  (use "git push" to publish your local commits)
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/xcuserdata/user.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
    modified:   Project/TPSettings.plist

no changes added to commit (use "git add" and/or "git commit -a")
User-MBP:Project user$ cat .gitignore
SubModules/
.DS_Store
Project.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
Project.xcodeproj/xcuserdata/user.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
User-MBP:Project user$ 
Run Code Online (Sandbox Code Playgroud)

该文件是在.gitignore所以它不应该告诉我提交文件.

Dav*_*sch 6

发生这种情况是因为有问题的文件已经在源代码管理中.您可以删除它们git rm --cached myFile.txt.在那之后,他们确实会被忽视.但需要注意的是:在推送更改后拉出回购的其他人将在工作目录中删除所述文件的本地副本,因此他们可能希望先备份.