转自: https://www.jianshu.com/p/587badb8a4ca
1:还没有加到版本控制中
(1)还没有git add
在 .gitignore中添加
(2)已经git add
先 git rm -r --cached 文件
在 .gitignore中添加
2:已经加到版本控制中
先 git rm -r --cached 文件
在 .gitignore中添加
最后 gti commit -m '提交.gitignore'
注解:
1:git update-index --assume-unchanged
git update-index --assume-unchanged /path/to/file #忽略跟踪
git update-index --no-assume-unchanged /path/to/file #恢复跟踪
2: 修改.gitignore添加完忽略文件,然后执行下列命令
git rm -r --cached .
git add .
git commit -m 'update .gitignore'
也是假装让git看不见文件,要团队中每个人都运行改命令,否则忽略不掉
浙公网安备 33010602011771号