Git: Delete a File

By Xah Lee. Date: .

How to delete a file or dir?

Use the git rm command, then do Commit .

git will delete the files/dir for you.

If you already deleted the files, you can still call git rm to update the staging area, then do a commit.

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's good, simply git add -A ., then do a commit. Git automatically take care of removed files, or files that have changed name.

git add, commit