Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is .gitignore not ignoring my files?

See the image below. My .gitignore file should be ignoring all files in src/dist, but isn't.

enter image description here

like image 994
Richard Avatar asked Jul 30 '17 13:07

Richard


People also ask

Why isn't my Gitignore working?

The Solution To resolve the problem remove from the repository the tracked files contained in the . gitignore file. To achieve this use “git rm” to remove and untrack all the files in the repository, then use “git add” to re-add all the files (the files contained in the .

Is Gitignore file ignored?

gitignore was having an effect--if the file was Unicode, it was ignored, if it was ASCII, it wasn't.

How do I force git to ignore a file?

Use Git update-index to ignore changes To resume tracking, run the git update-index command with the --no-skip-worktree flag. Or, you can temporarily stop tracking a file and have Git ignore changes to the file by using the git update-index command with the assume-unchanged flag.


1 Answers

.gitignore only ignores files that are not part of the repository yet. If you already git added some files, their changes will still be tracked. To remove those files from your repository (but not from your file system) use git rm --cached on them.

like image 121
Elmar Peise Avatar answered Sep 20 '22 09:09

Elmar Peise