Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: How to commit a manually deleted file? [duplicate]

Tags:

git

github

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.

like image 217
ronnie Avatar asked Oct 20 '12 11:10

ronnie


People also ask

How do I remove a deleted file from my git repository?

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.

Do you git add deleted files?

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.


2 Answers

The answer's here, I think.

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

like image 184
s.m. Avatar answered Oct 06 '22 14:10

s.m.


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

Note: use git rm for certain files.

like image 36
xdazz Avatar answered Oct 06 '22 12:10

xdazz