Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Untrack and stop tracking files in git

Tags:

git

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?

like image 607
Marc Avatar asked Feb 22 '13 15:02

Marc


1 Answers

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.

like image 158
Marc Avatar answered Oct 03 '22 03:10

Marc