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.
Delete Files using git rm. The easiest way to delete a file in your Git repository is to execute the “git rm” command and to specify the file to be deleted. Note that by using the “git rm” command, the file will also be deleted from the filesystem.
The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area.
The answer's here, I think.
It's better if you do git rm <fileName>
, though.
Use git add -A
, this will include the deleted files.
Note: use git rm
for certain files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With