-1

I have a working project, but there is a file I accidentally pushed to the remote branch and I need to ignore it in the .gitignore.

This is the structure:

/project
  /app..
  | ...
  | ...
  /public
    | myFile.json

I added this entry on my .gitignore file:

...
/public/myFile.json
...

But it continues recognizing it as a outgoing file. What am I missing here?

assembler
  • 3,098
  • 12
  • 43
  • 84

1 Answers1

2

You need to remove the file from git also as the old file is still tracked:

git rm --cached public/myFile.json

With the --cached the file will stay in your local copy.

Julian
  • 33,915
  • 22
  • 119
  • 174
  • other solution I just found is to delete the file, commit the changes on the gitignore and the deleted file, and then creating the deleted file again... it sounds like a tongue twister, but works – assembler Jun 24 '21 at 15:46