Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't disappear "untracked" folder in git status

Tags:

git

gitignore

I'm new to Git. A couple of days ago I tried to undo a "git add --all" with "git reset" after a quick Google suggested that. Luckily it appears no material harm was inflicted on my working directory, however Git has added a folder of angularjs modules I had listed in .gitignore, and now this folder (and everything in it) is showing up as "untracked" in "git status". It didn't prior to the reset, and nothing else in gitignore is doing this. I've tried a few solutions including "git rm -r --cached node_modules" and this Git untracked files list is wrong but it's still there. All suggestions appreciated!

like image 776
David Smith Avatar asked Feb 14 '23 22:02

David Smith


1 Answers

The ".gitignore first line" bug has been reported before in ".gitignore not working for me":

What really got gitignore working full for me was adding a comment on the first line of the file. Git wasn't parsing the exclude situated on the first line.

However, this shouldn't be a bug: the first line should work too.

What can change is:

  • the encoding of your file
  • a different eol (CRLF instead of LF) on the first line.
like image 165
VonC Avatar answered Feb 17 '23 19:02

VonC