tags:

views:

372

answers:

3

First off, I'm new to Git.

I deleted a bunch of files locally on my Mac using Finder. I want the files that I deleted to no longer show in the current branch, but they do.

Any Git ninja know a command to update the index?

+3  A: 

You can see deleted files, which are still 'tracked' with:

git ls-files --deleted

To delete files from a branch, you can do something like this:

git ls-files --deleted -z | xargs -0 git rm

From man git-rm:

Remove files from the index, or from the working tree and the index. git-rm will not remove a file from just your working directory. (There is no option to remove a file 13 only from the work tree and yet keep it in the index; use /bin/rm if you want to do that.)

Finally, to commit the "removal" do something like:

git commit -m "removed some files"
The MYYN
Thank you, what's next?
Zack
Then you need to commit the change - `git commit -m "removed some files"`
James Polley
yes, of course, thank you --
The MYYN
+1  A: 
polleyj@sombrero:~$ git help
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]

The most commonly used git commands are:
   ...
   rm         Remove files from the working tree and from the index
James Polley
+2  A: 

I think this would be a simpler way to do what you want:

git add . -A 

Then you would just do:

git commit -m "removed some files"

As noted above.

Samuel Mikel Bowles
Thank you. And I had just written alias in `bash` to do the above. Amazing.
Zack