Git: 如何提交手动删除的文件?

在我的 git 存储库中,我在将一个文件(rm)移动到另一个文件夹后手动删除了它。我比提交所有的变化,我的回购,但现在当我做 git status .

ronnie@ronnie:/home/github/Vimfiles/Vim$ 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:    plugin/dwm.vim
#
no changes added to commit (use "git add" and/or "git commit -a")

现在,我应该如何提交,以便从我的远程回购插件文件夹中删除 dwm.vim。我知道我必须使用 git add && git commit,但我没有文件提交/添加,因为 /plugin/dwm.vim已经被删除。

246512 次浏览

The answer's here, I think.

It's better if you do git rm <fileName>, though.

It says right there in the output of git status:

#   (use "git add/rm <file>..." to update what will be committed)

so just do:

git rm <filename>

Use git add -A, this will include the deleted files.

Note: use git rm for certain files.