init: git rm
In this video we'll learn how to remove files from a Git repository using
You can remove a file by deleting the file normally.
For example, by running the
Then you can add this change with
git status to verify our change.
While this works, it's a little awkward to delete the file and then add it.
Furthermore, this took two steps.
We can delete the file and stage the change in one, clear step with
In this case, by running:
git rm file-2.txt
If we run
git status we see it has the same effect.
So, when you want to remove a file from your Git repository,
git rm is the command.