git .ignore忽略文件夹中除了指定的文件外的其他所有文件

2019-05-10  本文已影响0人  极度嫌弃

只有二级目录的情况

//.ignore忽略文件夹中除了指定的文件外的其他所有文件
**/node_modules/*//忽略文件夹node_modules
!**/node_modules/vue-html5-editor/ //不包含vue-html5-editor文件夹

如果有多级目录
要保留:vue-html5-editor.js

//错误写法
**/node_modules/*//忽略文件夹node_modules
!**/node_modules/vue-html5-editor/dist/  //这样写是不生效的

//正确写法
**/node_modules/*
!**/node_modules/vue-html5-editor/
**/node_modules/vue-html5-editor/*
!**/node_modules/vue-html5-editor/dist
上一篇 下一篇

猜你喜欢

热点阅读