0. 前言
记录git 不追踪问题 modified content, untracked content
1. 问题
git status中存在 不追踪 的内容
网上的大部分方法都是删除.git文件,如下图所示,错误解决办法链接
如果当前项目 中含有子模块,该方法就行不通了,
2. 解决方法
根据原因是文件夹里面含有__pycache__文件,导致无法追踪,所以删除即可。
如果文件文件内容太多,逐个删除太耗时间,所以我们可以通过添加全局忽略,忽略掉所有的pycache文件
- 家目录下新建.gitignore_global文件
touch ~/.gitignore_global
- 添加忽略规则
- gitignore_global配置
git config --global core.excludesFile ~/.gitignore_global
可在家目录下查看是否生效(具体为:/home/w/.gitconfig文件)
- 通过git status查看现在项目是否能否被追踪
4. 1如果依然没有解决可删除缓存
git rm -r --cached .
参考
[1] https://www.jianshu.com/p/a28030ce6d39
[2] https://www.letianbiji.com/git/git-global-gitignore.html
[3] https://www.cnblogs.com/bigtreei/p/9670716.html
[4] https://blog.csdn.net/u010281877/article/details/109339306
[5] https://www.jianshu.com/p/b33b844e2011
[6] http://imhuchao.com/1461.html