10

Long story short, I accidentally added a file to .gitignore, which I committed and pushed.

Now I removed the file from .gitignore, but it's still not visible.

What else do I need to do?

Lord Zsolt
  • 6,492
  • 9
  • 46
  • 76

2 Answers2

10

I'm stupid, it was left in global gitignore, which is why it wasn't showing.

Lord Zsolt
  • 6,492
  • 9
  • 46
  • 76
2

You might want to recover that file from repository and commit it again:

git checkout 35fbd83 -- path/to/your/file

35fbd83 is SHA of a commit where that ignored file was still present.

git add path/to/your/file
git commit -m 'missing file is back'

After a file is added to .gitignore its not tracked anymore. If you accidentally or purposely remove that file while it's ignored, git won't complain and that file silently disappears from your file system. Commands like git reset --hard and git checkout could lead to a situation where ignored files are removed from your working directory.

Jay
  • 3,445
  • 2
  • 24
  • 29