Search code examples
gitgithubcommitgitignore

Angular + Git - How to Include a file from a package exists inside node_modules


I have ng-payment-card package and I've made some modifications in a file inside the package, and I need to include this file in the git commit in order to not reset it every time I make npm install.

I tried to write in .gitignore like this:

!/node_modules/ng-payment-card/__ivy_ngcc__/fesm2015/ng-payment-card.js

but the same, the file hasn't been added to the commit.


Solution

  • Even if the file is currently ignored, you can force adding it:

    git add --force  node_modules/ng-payment-card/__ivy_ngcc__/fesm2015/ng-payment-card.js
    

    That way, everything else remains ignored, while your file becomes tracked.