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?
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 )
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.
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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With