init: git rm
In this video we'll learn how to remove files from a Git repository using git rm
.
You can remove a file by deleting the file normally.
For example, by running the rm
command.
Then you can add this change with git add
.
Let's run 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 git rm
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.