一、问题原因
最近我写的自动化有多人开始介入,发现有些人提交了.pyc的文件

二、解决思路
这些文件已经被提交到远程了,但是我不需要它,以后也不想再提交类似的文件;思考之后决定删除它,并且保证以后其他人提交的时候不会再有这种文件了
三、详细步骤
# 删除该文件及缓存
git rm -r --cached wechatAppletPageAutomation/pageobjects/__pycache__/Page.cpython-36.pyc
# 继续删除另一个文件
git rm -r --cached wechatAppletPageAutomation/testcases/__pycache__/HomepageTestCase.cpython-36.pyc
# 查看是否删除
git status

四、修改.gitignore
*.pyc
wechatAppletPageAutomation/testcases/__pycache__/HomepageTestCase.cpython-36.pyc
wechatAppletPageAutomation/pageobjects/__pycache__/Page.cpython-36.pyc
__pycache__
五、提交文件即可
# 提交文件【可以全部提交,也可以选择提交,本文为全部提交】
git add .
git commit -m "提交理由"
git push "url" master
网友评论