Git pull, python pyc files -error: 您对以下文件的本地更改将被 merge: 覆盖



在我的 ec2 实例上,我正在尝试对我的 github 存储库执行拉取请求。 我收到以下错误。 在我的本地机器上,我提交所有内容。 如果这是问题所在,如何处理pyc文件?

git add .
git commit -m 't'
git push origin development
git pull
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 2 (delta 1), reused 2 (delta 1)
Unpacking objects: 100% (2/2), done.
From https://github.com/me/rtbopsConfig
   8e320f6..0565407  development -> origin/development
Updating 94f7f3e..0565407
error: Your local changes to the following files would be overwritten by merge:
    classes/ec2/ec2Auto.pyc
    classes/redis_ha.pyc
    classes/rtbUtilities.pyc
    rtb_redis_connections/redis_connections.pyc
Please, commit your changes or stash them before you can merge.
Aborting

你不应该在 Git 中存储.pyc文件。在您的工作站上,执行

find . -name *.pyc -exec git rm {} ;

然后添加一行*.pyc .gitignore,提交所有更改并推送。

在另一端 (EC2),执行

git checkout classes/ec2/ec2Auto.pyc classes/redis_ha.pyc 
             classes/rtbUtilities.pyc rtb_redis_connections/redis_connections.pyc

然后拉。

最新更新