Git: How to commit a manually deleted file?

GitGithub

Git Problem Overview


In my git repository I manually deleted a file(rm) after moving it to another folder. I than committed all the changes to my repo but now when I do 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")

Now, how should I commit so that dwm.vim is deleted from the plugin folder in my remote repo. I know that I have to use git add && git commit but I have no file to commit/add because /plugin/dwm.vim is already deleted.

Git Solutions


Solution 1 - Git

The answer's here, I think.

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

Solution 2 - Git

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

Note: use git rm for certain files.

Solution 3 - Git

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>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionronnieView Question on Stackoverflow
Solution 1 - Gits.m.View Answer on Stackoverflow
Solution 2 - GitxdazzView Answer on Stackoverflow
Solution 3 - GitKacheView Answer on Stackoverflow