如何 git rm 位于远程但不在本地的文件?
How to git rm files that are on remote origin but not in local?
我有一些 .swp 文件是我的编辑创建的,之前是不小心提交的。现在我想合并到 master 中,但需要删除这些文件。我试图从我的工作副本中删除它们,然后提交。现在文件已在本地删除,但仍存在于 github 的提交中。我试过 git rm path_to_files
,但是这个 returns fatal: pathspec 'path_to_files' did not match any files
,这似乎证实它们已经完全从我的本地副本中消失了。我怎样才能完全删除它们?谢谢
由于您的文件是从文件系统本地删除的,因此您应该能够:
git add . -A
git commit -m 'Deleted files'
或者只是:
git commit -m 'Deleted files' .
(注意最后一点,会添加已删除的文件)
如果您已经在本地删除了文件,只需提交操作
git commit -a -m "Committing deletion of files"
git push
我有一些 .swp 文件是我的编辑创建的,之前是不小心提交的。现在我想合并到 master 中,但需要删除这些文件。我试图从我的工作副本中删除它们,然后提交。现在文件已在本地删除,但仍存在于 github 的提交中。我试过 git rm path_to_files
,但是这个 returns fatal: pathspec 'path_to_files' did not match any files
,这似乎证实它们已经完全从我的本地副本中消失了。我怎样才能完全删除它们?谢谢
由于您的文件是从文件系统本地删除的,因此您应该能够:
git add . -A
git commit -m 'Deleted files'
或者只是:
git commit -m 'Deleted files' .
(注意最后一点,会添加已删除的文件)
如果您已经在本地删除了文件,只需提交操作
git commit -a -m "Committing deletion of files"
git push