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

时间:2012-06-20 12:07:12

标签: git github

在我的ec2实例上,我正在尝试对我的github repo进行拉取请求。我得到以下错误。在我的本地机器上,我承诺一切。如果出现问题,我如何处理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

1 个答案:

答案 0 :(得分:6)

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

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
然后拉。