Here you go:
root@Dell: /tmp # mkdir test; cd test
root@Dell: /tmp/test # git init
Initialized empty Git repository in /tmp/test/.git/
root@Dell: /tmp/test # mkdir foo
root@Dell: /tmp/test # touch foo/a
root@Dell: /tmp/test # git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# foo/
nothing added to commit but untracked files present (use "git add" to track)
root@Dell: /tmp/test # cat > .gitignore << EOF
> *
> !foo/
> EOF
root@Dell: /tmp/test # git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
Can anybody explain why an empty .gitignore is not equivalent to the one with:
*
!foo/
in this case?
You managed to make the directory
foo“not ignored”, but everything withinfoois still matched by the ‘*‘ pattern.This will remove
foocontent from the gitignore ‘*‘ initial directive:or:
plus a
.gitignoreinfoowith: