gitignore directory pattern ignores folder with same suffix, but I want to include it

前端 未结 3 1391
春和景丽
春和景丽 2021-01-04 01:43

I have the following directory structure:

src/
out/
cout/
...

and I want to ignore out/ but not cout/.

I\'ve tried pu

相关标签:
3条回答
  • 2021-01-04 01:57

    Which version of git are you using?

    With msysgit 1.6.3-preview20090507-2, the simple

    out/
    

    works for me. cout/ is still added to the repository.

    0 讨论(0)
  • 2021-01-04 02:05

    Exclamation mark(!) should precede a match which should not be ignored.

    The .gitignore file should look like:

    out/
    !cout/
    
    0 讨论(0)
  • 2021-01-04 02:09

    Sorry guys, my mistake! The cout directory was empty and, therefore, not showing up under git status.

    Just adding out/ works fine and doesn't ignore cout/.

    Thanks a lot!

    0 讨论(0)
提交回复
热议问题