1. Git删除已关联文件或文件夹
git rm --cached 文件名(包含子文件夹路径)
Example: $ git rm --cached WaveM_SPI_TOP/WaveM_CCD512_SPI_TOP_summary.html
git rm --cached 文件夹名(包含子文件路径)
Example: $ git rm -r --cached WaveM_SPI_TOP/iseconfig
2. Git忽略已关联文件或文件夹
步骤1:先进行删除操作
步骤2:新建.gitignore文本文件,并添加内容*.html(文件名);;; .iseconfig(文件夹)
步骤3:提交操作 git commit -m"Delete .html文件在本地库"
3. Git添加文件或文件夹全部文件
4. .gitignore 在已忽略文件夹中不忽略指定文件 及 文件夹下子文件夹的子文件
原文参考链接:http://comonly.cn/l/p/1652.html
注意:结尾的星号不能去,去掉就无效了
1.在已忽略文件夹中不忽略指定文件夹
/node_modules/*
!/node_modules/layer/
2.在已忽略文件夹中不忽略指定文件
/node_modules/*
!/node_modules/layer/layer.js
【注意项】注意写法要忽略的文件夹一定要结尾 /*,否则不忽略规则将无法生效
在已忽略的文件夹中不忽略指定的子文件夹
/objs/* #忽略objs
!/objs/lib/ #不忽略lib目录
/objs/lib/* #忽略lib目录
!/objs/lib/nginx-rtmp-module-master/ #不忽略lib/nginx-rtmp-module-master目录
3.其他规则写法 (附)
以斜杠“/”开头表示目录;
以星号“*”通配多个字符;
以问号“?”通配单个字符
以方括号“[]”包含单个字符的匹配列表;
以叹号“!”表示不忽略(跟踪)匹配到的文件或目录;