Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Git suggest "changes" to me on a (theoretically) ignored file (path)?

I'm using VS2015 GitHub extension, on a repositary I own (forked, really). Within the .gitignore file at some point I've this (taken from the fork, I didn't add myself that ignore):

...

VST3_SDK/*

...

but on VS2015 it seems to suggest a file within that folder has been "edited", and need to be staged:

enter image description here

I don't want this of course. These files/path should be "ignored" from versioning.

Where am I wrong?

EDIT: I don't want "workaround" to ignore it. I don't want to git it anymore...

like image 509
markzzz Avatar asked Mar 10 '17 08:03

markzzz


2 Answers

It seems the file was committed once (maybe before it was ignored, maybe someone forced Git to start tracking it).

You can remove the file from Git (but not your harddrive) using

git rm --cached VST3_SDT/base/win/base_vc10.vcxproj.user

Afterwards, instead of "modified" the file will appear as "deleted". This is expected and should be committed (this commit will fix the issue for all other developers on this project, too). Afterwards Git will ignore the file for you and everybody else.

like image 168
Nils Werner Avatar answered Nov 07 '22 01:11

Nils Werner


.gitignore works for files that are not part of the project yet. If a file is already part of the project (it is part of HEAD already) then .the file being part of .gitignore does not matter. If this file is already part of the project and you still don't want to see it as modified (weird, but possible) then you have to use git update-index to tell git to just not care about it.

like image 44
eftshift0 Avatar answered Nov 07 '22 01:11

eftshift0