Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between "Push..." and "Push to upstream..." in Eclipse

Tags:

git

eclipse

egit

When using "Push to upstream..." in Eclipse, the new "local" commits are pushed to remote repository and the remote branch ref is updated in the local repository (so master and origin/master reference the same commit).

When using "Push..." and adding a push ref on master in the wizard window (refs/heads/*), the new "local" commits are pushed to remote repository (like previously) but the remote branch ref is not updated in the local repository (so master reference the last commit but origin/master didn't moved).

What's the difference between these two ways of working? Is it useful for particular decentralized work flows? What would be the corresponding git commands of these two approaches?

like image 281
Florent Paillard Avatar asked Jan 06 '12 17:01

Florent Paillard


People also ask

What does it mean to push upstream?

pushing " upstream " means that your current branch B has remote/B has its upstream branch. Ie: branch. B. merge is set, when your are pushing the " upstream " branch. Ie: when pulling to B , git knows what branch to pull (as well as which remote repo: branch.B.remote )

What is push in Eclipse?

Committing a Change to the Eclipse.org server To do the local commit, select the file, right-click menu, Team -> Commit. 2) To push them back to the server, you need to "Push to Upstream". You can only push to upstream at the project/repo level. You can't push an individual file, like you can in CVS.

What does fetch from upstream mean in Eclipse?

fetch from upstream does not overwrite anything in the working tree. But pull will, but it will not completely destory work, it will create a conflict to manually merge if it can not do it automatically.

How do I push directly to upstream?

The easiest way to set the upstream branch is to use the “git push” command with the “-u” option for upstream branch. Alternatively, you can use the “–set-upstream” option that is equivalent to the “-u” option.


2 Answers

Push to Upstream.. pushes your branch as you would expect for a remote-tracking branch.

Push... opens a dialog and lets you specify which refspecs you should push up, including tags, special cases like HEAD:refs/heads/master, etc.

That it doesn't update origin/master seems like a bug to me, or maybe they're waiting for the next fetch to update origin. I'd open a bug at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EGit&component=UI

PW

like image 57
Paul Webster Avatar answered Oct 10 '22 11:10

Paul Webster


As suggested by Paul, I opened a bug on EGit's Bugzilla and got an explanation there.

When "Push..." is used, the EGit PushWizard calls JGit's command with the repositories URIs, not their names. That's why JGit cannot update remote tracking branch.

The bug is still Open so we may hope that in a future release, "Push..." done from a "Configured remote repository" will update remote tracking branch.

like image 41
Florent Paillard Avatar answered Oct 10 '22 09:10

Florent Paillard