如何使用rm而不是git rm提交我删除的文件?

时间:2012-09-25 16:53:02

标签: git version-control rm

git add似乎不适用于这些已删除的文件,那么如何提交更改?

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       deleted:    ci/ci/__init__.py
#       deleted:    ci/ci/settings.py
#       deleted:    ci/ci/urls.py
#       deleted:    ci/ci/wsgi.py
#       deleted:    ci/manage.py
#
no changes added to commit (use "git add" and/or "git commit -a")

1 个答案:

答案 0 :(得分:2)

最简单的选择是使用git add -A-A选项将暂存已添加和删除的文件。

如果您想要这么做,请在已删除的文件上使用git rm path/file.py进行删除(即使您已手动删除它们)。