1:背景描述
今天在修改代码时,尝试使用git status后查看代码变更记录时,发现刚刚修改的那个文件是以如下的形式出现的
hello_world.py___jb_tmp___
Untracked files: use "git add" to "git track"
没有常见的modified: qa/hello_world.py
并且查看项目目录,显然新增了这样的一个文件,而且影响自己正常的提交代码。
2:问题分析与解决
首先,这个新增的文件是一个缓存文件,不过我没有按照下面的提示做操作,直接的解决方案是
最后保存,应用,然后一定要重启pycharm,如果新打开的pycharm中还有之前创建的这个tmp文件,再删除掉即可,如下我重启后重新git status后
$ git status
On branch optimize_for_sg_data_upgrade
Your branch is up-to-date with 'leel/qa'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: qa/hello_world.py
Untracked files:
(use "git add <file>..." to include in what will be committed)
qa/hello_world.py___jb_tmp___
no changes added to commit (use "git add" and/or "git commit -a")
如上所示,说明这个__jb_tmp还在,但是此时可以直接从pycharm删除或者rm -f掉即可,之后就可以正常的提交代码了。