Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.gitignore not ignoring package.json [duplicate]

I have a node project and I am trying to ignore my package.json.

I have added package.json inside .gitignore.

Basically I am working on creating swimlanes and I have another project's package.json overwritting the existing project's package.json.

What i see happening is the package.json file is overwritting the existing and its not ignoring the new package.json althought its in the .gitignore.

I tried

git rm --cached 

and

git add .

But this is deleteing my package.json file from my local which I dont want

Expected: I need the package.json to be igniored when I pull the new package.json using grunt fetchFromArtifactory.

like image 897
cheddarDev Avatar asked Jul 27 '15 18:07

cheddarDev


1 Answers

If you already are tracking a file, you can't add it to .gitignore. Then git will start to track that file changes.

You can look at this answer to how to tell git to ignore changes in a tracked file.

like image 97
Larry Shatzer Avatar answered Nov 14 '22 22:11

Larry Shatzer