gitignore文件用法
怪我咯
怪我咯 2017-05-02 09:34:20
[Git讨论组]

在.gitignore文件中,以下两行作用有什么区别吗?

/data/cache/
/data/cache/*

怪我咯
怪我咯

走同样的路,发现不同的人生

全部回复(3)
某草草

看这里:

If the pattern ends with a slash, it is removed for the purpose of the
following description, but it would only find a match with a

  1. In other words, foo/ will match a directory foo and paths

  2. it, but will not match a regular file or a symbolic link

foo (this is consistent with the way how pathspec works in general in
Git)

在我看来,这两个命令没区别。都是过滤/data/cache/目录下的所有内容

PHP中文网

.gitignore配置文件用于配置不需要加入版本管理的文件,配置好该文件可以为我们的版本管理带来很大的便利。

  • 以斜杠“/”开头表示目录;

  • 以星号“*”通配多个字符;

  • 以问号“?”通配单个字符;

  • 以方括号“[]”包含单个字符的匹配列表;

  • 以叹号“!”表示不忽略(跟踪)匹配到的文件或目录;

希望对你有所帮助

PHP中文网

虽然意义不同,但是实现效果没有区别。都是屏蔽某个目录下的文件。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号