I want to ignore the dist
folder. So when there is a change in the dist
folder, it doesn't appear in the commit
In the .gitignore file, there had exist /dist
like this :
.DS_Store
node_modules
/dist
But why when there are changes it still appears?
How can I solve this problem?
With Git if you commit a file or folder, Git will continue to track it even if you put it inside your .gitignore
. Because .gitignore
just prevent untracked files from being added.
To stop tracking you have to remove it from Git index
git rm -r --cached <folder> // git rm -r --cached dist
It will keep the folder on your local but it will not being tracked anymore.
For folder in .gitignore
the correct format is dist/
with trailing slash
Check the format
.DS_Store
node_modules
dist/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With