Reputation: 13923
My .gitignore
contains dist
folder.
I have a file: dist/monorepo-docker-build-helper.js
which I need to track from now on (it's auto generated from a build-process).
.gitignore
file now:
dist
!dist/monorepo-docker-build-helper.js
When running git status
, dist/monorepo-docker-build-helper.js
is never listed, even after it was changed.
I looked at other answers: git add dist/monorepo-docker-build-helper.js -f
helps but when there is a new change, git status
doesn't show it.
What can I do to permanently add dist/monorepo-docker-build-helper.js
to git?
Upvotes: 1
Views: 164
Reputation: 169
I believe in this case you have to exclude dist/*
in the first rule, otherwise for Git the dist folder does not exist.
Upvotes: 1
Reputation: 188
In your case, you need to ignore not the dist
folder itself, but everything in it (dist/*
). This way the exclude afterwards will work as stated in this post.
You should really rethink why you want to commit generated files in the first place, because it's a bad practice to do so.
Upvotes: 1