1

在 .gitignore 中使用子目录条目时,“git clean -X”不会清理被忽略的子目录。

$ git init test
Initialized empty Git repository in /home/jpgariep/git/test/.git/
$ cd test/
$ mkdir -p a/b/c
$ touch a/b/c/test
$ echo '/a/b/' > .gitignore
$ git add .gitignore
$ git commit -m "Added .gitignore."
[master (root-commit) 94e2825] Added .gitignore.
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore
$ git status
# On branch master
nothing to commit (working directory clean)
$ git clean -X -d -f
$ ls a
b

为什么b还在?

Git版本:1.7.2.3

注意:这也在 2 个月前发布在 git 邮件列表上,但没有得到答复。

4

1 回答 1

1

显然,这是一个错误。

http://marc.info/?l=git&m=128561999924671&w=2

于 2010-10-03T20:33:17.090 回答