How to delete locally removed files within GIT

When you remove files from your local GIT repo, how do you commit that change back into the master line?  After doing a “git status” you may see something like this:

# Changes not staged for commit:
# (use “git add/rm <file>…” to update what will be committed)
# (use “git checkout — <file>…” to discard changes in working directory)
#
# deleted: path/to/some/file
# deleted: path/to/some/other/file
# deleted: path/to/yet/another/file

If you use “git rm *” you will literally process and stage a delete command to remove every file in the directory you are in.  This is not what we want in this case.  We ultimately want the equivalent of a “git add *” command to stage our local delete actions.

git add -u

The -u parameter attached to git add is the “update” command.  Fromt he GIT man page it states that this update command will look for modified contents of tracked files.  It also states that it will remove files from the index if the corresponding files in the working tree have been removed.  If not pathname is provided then it assume “.” as your working path.

A very easy command to understand.  This will allow you to delete locally removed files within GIT.

Comments

comments

Posted in and tagged .