Let's say that we just discovered that we no longer
need file to in our project because it contains unused code.
So to remove this file, we type RM file to the txt. Again, this
is not a good command because it doesn't start with Git. It's
just a standard Unix command. Okay, so let's go with this. Now
we have a yellow indicator, which means our working
directory is dirty. So let's run git status. We have one change
that is not staged for commit. So we remove file two from our
working directory, but still exists in the staging area. Let
me prove it to you. So we type git, LS dash files. These are
the files in our staging area. So file two still here, even
though we removed it from our working directory. So as I told
you before, every time we make changes, we have to stage those
changes using the Add command. So here we type git add file to
the txt to stage this change or this deletion more, actually
accurately. Now let's run git LS slash files one more time. So
file two is no longer in the staging area. Beautiful. Let's
run git status, we have one change that is ready to be
committed. And as you can see, it's indicated by green, which
means it's in the staging area. So let's commit this change. And
here we're going to say, remove unused code. So to remove a
file, we have to remove it from both our working directory as
well as the staging area. Because this is a very common
operation, git gives us a command that does both of these
steps in one go. Let me show you. So we type Git RM. So
instead of using the standard rm command in Unix, we use Git Rm
karolis, the file name, like file two dot txt, we can also
specify multiple files. We can also use patterns like all text
files. When we execute this command, git remote this file
from both the working directory as well as the staging area.