Git: Delete a File
How to delete a file or dir
Use the git rm
command, then do
Commit
.
git rm filename
git rm -r dirName
git will delete the files or dir for you.
If you already deleted the files, you can still call git rm
to update the staging area, then do a commit.
No need to use git rm
With git, you normally never use git rm
command.
You simply {delete, add, change} files on your dir in your normal work flow. When all is good, simply
git add .
, then do a commit. Git automatically take care of removed files, or files that have changed name.