35

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?

Florent Paillard
  • 549
  • 1
  • 6
  • 20
  • 2
    Good question; I never heard and can't imagine of a use-case where the remote tracked branch is not updated when pushing. – Mot Jan 06 '12 at 17:43

3 Answers3

16

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

Paul Webster
  • 10,614
  • 1
  • 25
  • 32
4

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.

Florent Paillard
  • 549
  • 1
  • 6
  • 20
0

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

Extra settings with push are available from either the Git Repositories or Package Explorer views, but you must choose the correct option.

From Git Repositories view:

  1. Right-click the name of the repo.
  2. Choose Push
  3. Click Next

OR

  1. Expand the Remotes folder.
  2. Right-click on origin
  3. Choose Configure Push...
  4. Click the Advanced button

(You can also expand origin then right-click on Push and go to Configure Push... then press the Advanced button)

From the Package Explorer view

  1. Right-click on the project folder (top most item).
  2. Team -> Remote -> Push -> Next (equivalent to pressing the "Advanced" button in the steps above.)

OR

  1. Right-click on the project folder (top most item).
  2. Team -> Remote -> Configure Push to Upstream...
mike
  • 1,135
  • 4
  • 22
  • 39