I have dir structure like this:
static admin ajax_upload books css font media robots.txt templates src build lib
I want to ignore following direcotories:
I want to allow following:
So I use the following .gitignore:
# Ignore /lib /src /build /static/* # Allow !/static/css/bootstrap-styled.css !/static/css/main.css !/static/css/font-*.css !/static/font !/static/media/default.png !/static/robots.txt
But it doesn't work properly. Could you help me - what I do wrong here? TIA!
Details
Real project structure is like this:
static admin css img js admin ajax_upload books css font media uploads blog gallery default.png robots.txt templates src build lib
gitignore file is usually placed in the repository's root directory. However, you can create multiple . gitignore files in different subdirectories in your repository.
gitignore file does not exclude the directories unless I fully qualify the ignore pattern as Solution/Project/bin/Debug - which I don't want to do as I will need to include this full pattern for each project in my solution, as well as add it for any new projects added. Any suggestions?
Git ignore patterns An asterisk is a wildcard that matches zero or more characters. Prepending an exclamation mark to a pattern negates it. If a file matches a pattern, but also matches a negating pattern defined later in the file, it will not be ignored.
So, the .gitignore works for me is the following:
# Ignore lib/ src/ build/ static/**/* # Allow !static/css/bootstrap-styled.css !static/css/main.css !static/css/font-*.css !static/font/* !static/media/default.png !static/robots.txt
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