为什么 Git 总是忽略子文件夹
我有这个 .gitignore 文件:
# Ignore wordpress
/wordpress/
/wordpress/*
# Except the wp-content folder
!/wordpress/wp-content/
!/wordpress/wp-content/*
但是当我更改 wp-content 中的某些内容时,git status 不会列出更改,如果我这样做,
git add wordpress/wp-content
我仍然会收到警告 .gitignore contains /wordpress/ ,因此不会添加更改。这是为什么呢?
附加
我在 OSx 上,运行 git 1.7.3.2
I have this .gitignore file:
# Ignore wordpress
/wordpress/
/wordpress/*
# Except the wp-content folder
!/wordpress/wp-content/
!/wordpress/wp-content/*
But when I change something in wp-content the changes aren't listed by git status, and if I do
git add wordpress/wp-content
I still get a warning .gitignore contains /wordpress/ and so doesn't add the changes. Why is this?
Aditional
I'm on OSx, running git 1.7.3.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为您想要忽略
wordpress
目录本身,因为wordpress
目录中有一些您确实想要跟踪的内容。您只需忽略wordpress
目录中的大部分顶级路径。这个 .gitignore 应该足够了。
I don't believe that you want to ignore the
wordpress
directory itself because there are some things in thewordpress
directory that you do want to track. You only need to ignore most of the top-level paths in thewordpress
directory.This
.gitignore
should be sufficient.