we do have a few folders in our projects called dist
. These shall be ignored by git. On the other hands just putting dist/
into the .gitignore
file does have side effects when using bower, since the dist folders within bower_components/
are ignored as well.
Any suggestions on how to correctly define a rule, that ignore dist
folders except the ones within bower_components
?
You want to use /* instead of * or */ in most cases The above code would ignore all files except for . gitignore , README.md , folder/a/file. txt , folder/a/b1/ and folder/a/b2/ and everything contained in those last two folders.
gitignore is a plain text file in which each line contains a pattern for files or directories to ignore. It uses globbing patterns to match filenames with wildcard characters. If you have files or directories containing a wildcard pattern, you can use a single backslash ( \ ) to escape the character.
You can have multiple . gitignore , each one of course in its own directory. To check which gitignore rule is responsible for ignoring a file, use git check-ignore : git check-ignore -v -- afile .
Sure:
dist/
!bower_components/**/dist/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With