Vince
Vince

Reputation: 4401

EGit/GitHub on eclipse/pydev : how to push my new code?

I am working with github/egit with eclipse.

Today I worked on a project:

Now I want to push it. But I have no idea how.

"push to upstream" gives me an error message :

master:master [rejected - non-fast-forward]

If I try to synchronize, the only changes I see with remote github code and my code are the modifications I just made today. "fetch from upstream" confirms everything is to date. Visiting the github website confirmed the repository is not up to date with my new code.

Any advice ?

EDIT: Another symptom : when I "pull" the project, I get:

 Updated Results:
 Result : Failed
 Failed Paths : DIRTY_WORKTREE [project_name]/[file_name]

[file_name] is a *.pyc I did not commit.

Upvotes: 1

Views: 992

Answers (1)

Caius Brindescu
Caius Brindescu

Reputation: 607

The "non-fast-forward" error happens when try and push to a remote branch that has commits that your local branch does not. A pull (which will do a merge) and then a push should solve this.

As far as the pull error message goes, it seems that you have committed a binary file to your repository. Try resetting it to the versioned version (by using git checkout [file.pyc]). This should stop git from complaining when you do the pull. Also, closing eclipse might help. I have not used the PyDev plugin for a while now, but eclipse has incremental auto-compilation for most things these days. That might interfere by rewriting the file before you manage to do the pull. Once the pull succeeds you should be able push your changes to GitHub.

As a side note, it's a good idea not to version your binary files that result from compilation (the *.pyc's in your case). Git cannot diff them, and they will only cause trouble in the long run. Also, they can be reproduced by recompiling the project, so there is no need to keep them.

I hope this helps,

-Caius

Upvotes: 2

Related Questions