I tested it with Git for Windows, and a first issue comes from the double-quotes:
echo "foo/**" > .gitignore
That will give you a .gitignore
file with:
"foo/**"
That is enough to ignore the foo
folder but not its content:
a git check-ignore -v -- foo\bar
would return nothing.
As described in "How do you strip quotes out of an ECHO'ed string in a Windows batch file?", use:
echo|set /p="foo/**" > .gitignore
That way, you have a .gitignore
with:
foo/**
And git check-ignore -v -- foo\bar
does work.
$ git check-ignore -v foo/bar
.gitignore:1:foo/ foo/bar
In both cases though, git clean -nfdX
does not remove anything.
Only by mentioning the file directly would git clean propose to do anything:
vonc@vonc MINGW64 /d/git/tests/ign/foo (master)
$ git clean -nX
vonc@vonc MINGW64 /d/git/tests/ign/foo (master)
$ git clean -nX bar
Would remove bar
To really make it work, your rule should not use '**
'
echo|set /p="foo/" > .gitignore
Then git clean -ndX
would work.
D:\git\tests\ign>git clean -ndX
Would remove foo/