I've looked at this answer: Unignore subdirectories of ignored directories in Git
And as far as I can tell I am doing the same thing, but git refuses to unignore my directories/files.
These are my rules. I'm trying to just get the listed directories/subdirectories, but the entire public directory is not showing up.
/public/bootstrap/*
!/public/bootstrap/bower_components/bootstrap/dist/*
!/public/bootstrap/bower_components/bootstrap/dist/**/*
!/public/bootstrap/bower_components/bootstrap/less/variables.less
Any ideas?
under the git repository. You can use patterns with ! as the prefix to “unignore” files. From gitignore man page: An optional prefix “!” which negates the pattern; any matching file excluded by a previous pattern will become included again.
There is no explicit git ignore command: instead the . gitignore file must be edited and committed by hand when you have new files that you wish to ignore. . gitignore files contain patterns that are matched against file names in your repository to determine whether or not they should be ignored.
You have the option to use double Asterisk (**) to match any number of directories and files. For example, Test/**/*. txt will tell git to ignore only files ending with . txt in the test directory and its subdirectories.
git folder is ignored by default. All others are deamed potentially important for the source-base unless configured otherwise within the repository or at a global level.
A command line that helps testing if you got it right: https://git-scm.com/docs/git-check-ignore
The following CLI:
git check-ignore -v .idea/bbb.txt .idea/workspace.xml .idea/runConfigurations/Android_Debug___ReactNative.xml android/.idea/aaaa.txt android/.idea/runConfigurations/app.xml
Outputs the following:
.gitignore:33:**/.idea/** .idea/bbb.txt
.gitignore:33:**/.idea/** .idea/workspace.xml
.gitignore:35:!**/.idea/runConfigurations/* .idea/runConfigurations/Android_Debug___ReactNative.xml
.gitignore:33:**/.idea/** android/.idea/aaaa.txt
.gitignore:35:!**/.idea/runConfigurations/* android/.idea/runConfigurations/app.xml
Pay attention that the 3rd and 5th lines are successfully un-ignored (watch for the "!" sign).
My .gitignore file:
**/.idea/**
!**/.idea/runConfigurations/
!**/.idea/runConfigurations/*
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