Ios 在Xcode中重命名的文件,现在无法在不取消选择文件的情况下提交

Ios 在Xcode中重命名的文件,现在无法在不取消选择文件的情况下提交,ios,xcode,git,commit,renaming,Ios,Xcode,Git,Commit,Renaming,在我的项目中,我有一个UITableViewController子类,其中包含名为“someTableViewController.h”和“someTableViewController.m”的文件,一时兴起,我决定将它们重命名为“someTableViewController.h”和“someTableViewController.m”,但过了一会儿,我决定以前的外观更好,并将它们的名称改回原来的名称 但是,现在每当我尝试提交时,Xcode都会抛出一个错误,说“error:pathspec'P

在我的项目中,我有一个UITableViewController子类,其中包含名为“someTableViewController.h”和“someTableViewController.m”的文件,一时兴起,我决定将它们重命名为“someTableViewController.h”和“someTableViewController.m”,但过了一会儿,我决定以前的外观更好,并将它们的名称改回原来的名称

但是,现在每当我尝试提交时,Xcode都会抛出一个错误,说“error:pathspec'Project/SomeTableViewController.h'不匹配git已知的任何文件”和“error:pathspec'Project/SomeTableViewController.m'不匹配git已知的任何文件”。似乎Xcode一直认为文件的过时名称仍然存在,并拒绝承认它们被更改


我可以绕过它的唯一方法是在提交之前在提交窗口中手动取消选择这两个文件,但我不想每次提交时都这样做,因为我预计这个项目很容易达到至少100次提交。有没有办法在不添加.gitignore文件的情况下修复此问题?

我也遇到了类似的问题,我收到了相同的错误:

git checkout branch_name
error: pathspec 'mybranch_name' did not match any file(s) known to git.
发生这种情况的一个主要原因是,在本地获取的repo中没有匹配的branch_名称,或者存在分支的多个克隆,因此git不知道在初始分支创建时要签出哪个分支

其思想是使用以下命令:

git checkout -t -b branch_name origin/branch_name

看看doublejosh的问题()可能会有用,它可能会提供进一步的信息


我希望有帮助

我从源代码处签出并替换了现有的项目,但Xcode仍然认为存在名称过时的文件:(
git checkout -t -b branch_name another_repo/branch_name