44

I have a deep subfolder called objects with files called *.object which I don't want tracked by git (Windows).

In .gitignore I have tried various combinations (e.g. **/objects/* or **/objects/* etc.) to no avail: each time, when I do git status I see:

# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       foo/src/objects/a.object
#       foo/src/objects/b.object

It is only when I add *.object to .gitignore that the files disappear from the untracked files list. What's wrong with my wild cards?

Also, when is git update-index required and when should I do git rm --cached myfile?

Is there a wildcard feature for rm like git rm --cached **/foo/*.zip?

UPDATE: Similarly, adding the line .gitignore to .gitignore (not always desirable but still) has no effect. Is this weirdness because the files may have been tracked in the past?

Marc
  • 13,011
  • 11
  • 78
  • 98

1 Answers1

89

OK, though wildcards don't work (in Windows apparently) it seems one can remove a whole folder with:

git rm -r --cached "path/to/foo/"

I understand that --cached only unstages - you have to git commit to remove them from the repo.

Marc
  • 13,011
  • 11
  • 78
  • 98