Why on my git changes this files are added? I cannot find solution for this and reason. Also adding to .gitignore does not help. Thanks in advance for any tips on that!
I tried to add to .gitignore, update next, clear cache
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
.next``
.next/
.next
.next/cache
.next/cache/images/XRLy2mj54hjpCmhHptAEqpb2WAUeGZGkZ7YPqY1zd7w=/60.1702714879042.Yhst-HY-v0t4UaR56ciP57mFAJtqv4BZZ5OqWkE94F8=.webp
*.js
.next/static/chunks/webpack.js
Each time i push commit and run the app the new changes (.next/cache/webpack are added to my git changes) even though i never touch this files
3
Answers
Try to add to your gitignore:
For Next.js, here is the recommended .gitignore file
You can also stack multiple project type using some gitignore generator tool online, like this one
I suspect that the folder was commited at some point and now it’s in the staging area. You first need to remove it from the staging area and then it will be ignored.
Try this:
.gitignore
the folder.next
or whatever you want to avoid commiting..next/
from the staging area:git rm -r --cached .next/