gitignore只对未跟踪的文件起作用。

对已提交的文件,要忽略,可以用以下方法:

例如config.json这个文件

1. gitignore添加config.json

2. 执行命令,从缓存忽略

rm config.json
git rm --cached config.json 
git add config.json 
git commit -m "ignore config.json"
git push

 

 
 
 
参考:https://zhuanlan.zhihu.com/p/270144760

相关文章:

  • 2021-12-16
  • 2021-11-30
  • 2022-12-23
  • 2021-04-14
  • 2021-08-11
  • 2021-08-26
  • 2021-10-12
猜你喜欢
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案