On Wed, Sep 2, 2009 at 4:25 PM, andholt<andh...@gmail.com> wrote:
> A few days ago I accidentally committed a directory of generated
> images, so I removed them (git rm) and committed again. I then added
> the directory to .gitignore, and pushed to the remote repository. When
> I did so, it uploaded all of the image files, and proceeds to do so
> every time I push, even though none of them are in the commit (git
> status shows only the other files I change).
> Do I need to take the directory out of the .gitignore and remove it
> from a commit again? Is there something else I potentially did wrong?

First of all, .gitignore tells git to ignore UNTRACKED files, it
doesn't remove tracked files.

So you need to use
     git rm --cached

to remove then from the index but leave them in your working set, and
commit, the .gitignore will keep them from showing up as untracked
when you use git status.

Second, realize that push is not a remote commit, it's a one-way sync
of the blobs in your repository with the remote one.  So when you
pushed with the files in the commit they went to the remote
repository.  And everytime you push, it's going to send all of commits
in the history of the branch which aren't already on the remote, not
just the latest one.

Now there are way of rewriting the git history so as to remove blobs
you REALLY don't want, for example if you commit a config file with
sensitive info that you really didn't want in the repository, but it's
a bit tricky and something you don't want to do normally particularly
when you've already pushed to a remote repository which others might
have pulled/fetched from.

> The other person working on the project does not get the files when
> pulling, so it appears to be something I did locally.

Not sure what to make of this.

Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to