The .gitignore file is used in Git to ignore some unwanted files (e.g. .o, .obj, .exe files). The .gitignore file specifies intentionally untracked files to ignore.
If you want to untrack some files that are tracked, first you have to remove the file from the index (repository cache) and then you have to add to the .gitignore.
V.gr, if you want to untrack the tracked “style.css” file, first you have to untrack it using the “git rm” command
$ git rm --cached style.css
and then you have to add the filename (“style.css”) to the “.gitignore” file using a text editor or the command
$ echo 'style.css' >> .gitignore