I know there a dozen of posts on SO. Some date back to '12. I am not able to get it work. In a modern world scenario. I have an angularJS project with a structure like
.
├── app
│ ├── app.js
│ ├── assets
│ ├── bower_components
│ ├── controllers
│ ├── index.html
│ ├── services
│ └── views
├── bower.json
├── e2e
│ ├── pages
│ ├── protractor.conf.js
│ └── scenarios
├── karma.conf.js
├── LICENSE
├── package.json
└── README.md
|__ .gitignore
In my bower_components, I have edited a module to suit my needs and I need to commit it so that changes are reflected for everyone. But not all of bower_components.
So I have a module in app/bower_components/chartist which I want to commit rest I want to ignore.
From here I tried this
logs/*
!.gitkeep
node_modules/
!app/bower_components/
app/bower_components/*
!app/bower_components/chartist
tmp
.DS_Store
.idea
app/jspm_packages
It doesn't work. In my git status, I see this as output
.gitignore~
app/bower_components/
It is including all of the bower_components. Why? How do I include only the chartist folder and leave out the rest? Rules are exclusion are too damn confusing. Can anyone simplify it for me?
EDIT: My question is asking how to add a folder in .gitignore but leaves a subfolder inside it. For which I need to track changes. I don't understand how can someone consider a duplicate of that question.