Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

space at beginning of line in .gitignore seems to get the line ignored

The only difference between the .gitignore is a space at the beginning of a line, and it seems to make the line ignored. Why is the result different. I add the space for alignment.

enter image description here
I expect the outcome should be the same.

The wrong intuition may come from this rule which says nothing about beginning space. I did see the word trailing though.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Trailing spaces are ignored unless they are quoted with backslash ("\").

>Solution :

The difference between d1/* and d1/* is that the first ignores everything under the folder named d1 and the second ignores everything under the ' d1' folder.

The reasoning behind this is that folders can start with blank spaces.

So those two .gitignore files are matching different folders. Hence why the second one includes everything under d1 folder.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading