I am getting my feet wet with Git and have the following issue:
My project source tree:
/
|
+--src/
+----refs/
+----...
|
+--vendor/
+----...
(extending the other answers)
Note, git check-ignore
uses the committed .gitignore
and not the one in your working tree! To play with it without polluting your git history, you might freely try to edit it, and then commit with a git commit --amend
.
This problem happens mainly if you need a workaround of the problem, that git doesn't follow directories. Enter in the .gitignore
:
dirtokeep/**
!dirtokeep/.keep
.keep
should be a zero-length file in dirtokeep
.
The result will be that everything in dirtokeep
will be ignored, except dirtokeep/.keep
, which will result that also the dirtokeep
directory will be constructed on clone/checkout.