For example, In the Mac OS, there is the .DS_Store directory in all directory. So you want ignore the .DS_Store directory from version control.
To ignore directory recursively , use .gitignore like this.
1 |
.DS_Store |
Then the .DS_Store directory which in all directory under working directory will be ignored.
Template for .gitignore is https://github.com/github/gitignore .
It’s useful because they have lots of templates for many environments.
If you already git add, you can restore by
1 |
$ git rm -r --cached . |
above command.(Do not forget period(.) )
If you already committed, then you can restore by
1 |
$ git rm --cached file |
above command.
this doesn’t work for me. I also tried
**/node_modules
&*/*node_modules
the solution is to just put the directory name
node_modules
this is recursive by defaultYes, you are right. I checked and found I had mistake. I fix the article.
Thank you.
This is what I’ve been looking for.