Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330048

Summary: Allow commit and push to remote in one interaction
Product: [Technology] EGit Reporter: Miles Parker <milesparker>
Component: UIAssignee: Project Inbox <egit.ui-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: adietish, benjamin.dev, bruno.do.medeiros, caniszczyk, daniel_megert, info, kevinsheedy, Lars.Vogel, manderse, markus.kell.r, matthias.sohn, remy.suen, richard.eckart, robin, rsternberg, stryker
Version: 2.0   
Target Milestone: 2.1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 388913, 389708    
Attachments:
Description Flags
allow the user to push the changes when committing
none
shows a possible layout for push options in the commit dialog
none
shows a possible layout for push options in the commit dialog (2) none

Description Miles Parker CLA 2010-11-11 18:16:15 EST
With the traditional VCS, we're able to do a single UI action to get changes to the repository. Given Git's distributed nature, the pushes and commits are separate. But as the Eclipse workflow (or at least my approach) is typically to make a change and want to get it up to the repos immediately, I need to go through two UI steps with some wizard interaction as well for the push.

It would be nice to have a one step "commit and push" action. This might use the default push setup so that you could simply click the commit and push button and have the push happen as well if you have the remote push set up correctly. Alternatively you might combine the two into a single wizard.
Comment 1 Miles Parker CLA 2011-08-05 15:37:52 EDT
(In reply to comment #0)

> It would be nice to have a one step "commit and push" action. This might use
> the default push setup so that you could simply click the commit and push
> button and have the push happen as well if you have the remote push set up
> correctly. Alternatively you might combine the two into a single wizard.

As I become more familiar with Git and EGit, probably a better approach would be to add a check box in the commit dialog for "also push to remote repos".
Comment 2 Lars Vogel CLA 2011-08-05 15:39:44 EDT
+1
Comment 3 Ralf Sternberg CLA 2011-08-10 05:18:39 EDT
I think whether you want to push now or later is not a personal preference but depends on the task (e.g. a multi-step change) and maybe on the network availability. I presume that I would often forget to check the status of the checkbox and thus forget to push or push unintentionally.

What about a dialog that pops up after committing: Push changes to upstream [Ok] [Later] ?
Comment 4 Lars Vogel CLA 2011-08-10 06:57:40 EDT
Popups a always getting annoying. I think a optional flag would be better.
Comment 5 Ralf Sternberg CLA 2011-08-10 07:37:39 EDT
Agree, unnecessary pop-ups are annoying. Anyway, I don't think that a check box is suitable for a decision that might change from commit to commit.
Comment 6 Andre Dietisheim CLA 2011-08-10 09:24:41 EDT
We currently need this functionality for JBoss Tools (https://issues.jboss.org/browse/JBIDE-9511) and we would gladly contribute a patch for this.
Comment 7 Matthias Sohn CLA 2011-08-10 09:46:56 EDT
(In reply to comment #6)
> We currently need this functionality for JBoss Tools
> (https://issues.jboss.org/browse/JBIDE-9511) and we would gladly contribute a
> patch for this.

+1

find the contributor guide here [1] let me know if you need any help

[1] http://wiki.eclipse.org/EGit/Contributor_Guide
Comment 8 Miles Parker CLA 2011-08-10 15:13:50 EDT
(In reply to comment #5)
> Agree, unnecessary pop-ups are annoying. Anyway, I don't think that a check box
> is suitable for a decision that might change from commit to commit.

That's an important point. You'd really want to avoid the case where someone pushed when they didn't intend to just because they'd forgotten to uncheck the dialog. What I'm thinking is that the box should always be unchecked when the dialog loads regardless of what the user did on the last push. Does this address your concern? It would mean that the workflow is unchanged for those users who aren't interested in this feature but would avoid more popup thrash.
Comment 9 Ralf Sternberg CLA 2011-08-11 06:27:44 EDT
Yes, that sounds reasonable to me. That would be similar to the "delete from disk" checkbox that you get on Project -> Delete. It also seems to be off by default regardless of the last delete operation.
Comment 10 Andre Dietisheim CLA 2011-08-23 10:35:57 EDT
Created attachment 202005 [details]
allow the user to push the changes when committing

I added a checkbox to the commit dialog and execute the push command if it is checked.
Comment 11 Matthias Sohn CLA 2011-08-24 07:27:47 EDT
(In reply to comment #10)
> Created attachment 202005 [details]
> allow the user to push the changes when committing
> 
> I added a checkbox to the commit dialog and execute the push command if it is
> checked.

Could you push this patch to Gerrit for review as described in the contributor guide [1] ? I can assist if you face problems with that.

[1] http://wiki.eclipse.org/EGit/Contributor_Guide#Contributing_Patches
Comment 12 Andre Dietisheim CLA 2011-09-02 06:04:02 EDT
I currently push to gerrit and the discussions are going on in the review of http://egit.eclipse.org/r/#change,4103,patchset=2:

The issue came up what kind of push shall be executed: 
the fully fledged push with UI that would allow you to choose the repo to push to or the simple one that just pushes to upstream.

Matthias argues that the majority of users would only want to push to upstream. We have the requirement to be able to push to a repo that is not the origin (we work on tooling that would push a githup project to a cloud server).
What about providing 2 checkboxes? 1 to push to upstream and anotherone that would allow you to choose the repo to push to?
Comment 13 Andre Dietisheim CLA 2011-09-02 08:20:21 EDT
Another issue that came up with the review of my latest patch in gerrit (http://egit.eclipse.org/r/#change,4103,patchset=2) is that the PushActionHandler is not active if you choose "Commit" in the context menu while selected  a file/package/folder (and not the project). The push of course then cannot be executed since the PushActionHandler is bound to the following enablement expression:

<adapt
   type="org.eclipse.core.resources.IProject">
</adapt>

I could solve that easily by changing the expression to enable the handler whenever a IResource is selected (or add an adapter factory that would adapt a IResource to an IProject). 
I fear though - and I'm not used enough to use egit so far - that this change may enable the push command in cases that you dont want it to be available in the context menu. I assume you had reasons to not enable the PushActionHandler when files/packages/folders were selected.

Any suggestions?
Comment 14 Max Rydahl Andersen CLA 2011-09-16 14:19:18 EDT
(In reply to comment #13)

For what it is worth the fact I have to navigate up to the root of the project to perform Push is one of my biggest annoyance at the moment with egit - I wish it was reachable from any resource.
Comment 15 Remy Suen CLA 2011-09-16 15:12:14 EDT
(In reply to comment #14)
> For what it is worth the fact I have to navigate up to the root of the project
> to perform Push is one of my biggest annoyance at the moment with egit - I wish
> it was reachable from any resource.

Same for me.
Comment 16 Miles Parker CLA 2011-09-16 15:20:08 EDT
(In reply to comment #15)
> (In reply to comment #14)
> > For what it is worth the fact I have to navigate up to the root of the project
> > to perform Push is one of my biggest annoyance at the moment with egit - I wish
> > it was reachable from any resource.
> 
> Same for me.

Hey, get your own bug! ;)
Comment 17 Remy Suen CLA 2011-09-16 15:26:33 EDT
(In reply to comment #16)
> Hey, get your own bug! ;)

Sorry, Miles. Actually, we already have bug 302078. :P
Comment 18 Andre Dietisheim CLA 2011-09-16 16:30:24 EDT
(In reply to comment #17)
> (In reply to comment #16)
> > Hey, get your own bug! ;)
> 
> Sorry, Miles. Actually, we already have bug 302078. :P

oh, awesome, good to know. 
I'll comment the bug there and ask for special reasons to have push only enabled on projects?
If not it would pretty much meet my needs in the usecase of this bug (I need the push handler to be activated when you commit).
Comment 19 Andre Dietisheim CLA 2011-09-20 10:45:09 EDT
Created attachment 203688 [details]
shows a possible layout for push options in the commit dialog

I added a screenshot that shows how the commit-dialog could look like if it would allow you to push your changes when the commit was successful.
It allows you to choose not push,  to push to upstream or  to push to a specific remote (you'll select in the upcoming dialog).
The default is not to push anything (left most radio is selected)
Comment 20 Miles Parker CLA 2011-09-20 21:11:42 EDT
(In reply to comment #19)
> Created attachment 203688 [details]
> shows a possible layout for push options in the commit dialog

$.02: It seems that we could simplify that. Maybe just a single checkbox with default off. Might not even need a separate sash. Presumably if someone wanted to push somewhere that wasn't the default repos they should probably be configuring that repos somewhere else. I see this as more of a quick convenience thing.
Comment 21 Ralf Sternberg CLA 2011-09-21 04:21:46 EDT
(In reply to comment #20)
> $.02: It seems that we could simplify that. Maybe just a single checkbox with
> default off. Might not even need a separate sash. Presumably if someone wanted
> to push somewhere that wasn't the default repos they should probably be
> configuring that repos somewhere else. I see this as more of a quick
> convenience thing.

+1 That was also my thinking when I saw the draft. The radio buttons make it more complicated to use because choosing between three options demands more brain cycles than answering a yes/no question. Users will have to read the texts to make the decision, maybe even wonder "but my upstream repository *is* a remote repository". A single checkbox named "push to upstream" is much easier to grasp. If it's checked, the commit will be pushed. You don's have to read.

Simple things (push to upstream) should be simple, advanced things (push to another repo) should be possible - and they are already. I guess most of the users will have only one remote repository.
Comment 22 Lars Vogel CLA 2011-09-21 04:34:55 EDT
+1 For A single checkbox named "push to upstream"
Comment 23 Andre Dietisheim CLA 2011-09-21 05:27:20 EDT
ok, to switch to a single checkbox which would allow you to push to upstream and dropping the capability to push to a specific remote. Pushing to a specific remote would only be available in an additional step, choosing "Push" in the context menu. 
On the other hand I still believe that a separate section is a good thing to have since it clearly separates this from the rest visually. To me it is beneficial to  get it visually already that this is another option (not related to the sections above)
Comment 24 Andre Dietisheim CLA 2011-09-21 05:32:50 EDT
Created attachment 203744 [details]
shows a possible layout for push options in the commit dialog (2)

added a new screenshot of a possible layout in the commit dialog. It now uses a single checkbox that would allow you to push changes to upstream. The checkbox is in its own section so that this possibility is visually separated from the rest.
Comment 25 Miles Parker CLA 2011-09-21 14:13:26 EDT
(In reply to comment #24)
> Created attachment 203744 [details]
> shows a possible layout for push options in the commit dialog (2)
> 
> added a new screenshot of a possible layout in the commit dialog. It now uses a
> single checkbox that would allow you to push changes to upstream. The checkbox
> is in its own section so that this possibility is visually separated from the
> rest.

+1 I think it does make sense to have it visually separated. For generality, you might call the heading "Options" or even "Post-Commit Actions" or something like that.
Comment 26 Rob Stryker CLA 2011-10-02 23:08:58 EDT
(In reply to comment #16)
> Hey, get your own bug! ;)

Just curious, but how do we push along bugs that don't seem to move anywhere? I've had a bug opened WITH a patch for more than 2 months and nobody has addressed it. 

https://bugs.eclipse.org/bugs/show_bug.cgi?id=353170

I would love to know what the process is to make sure this stuff gets seen. Kinda sad that a bug with a patch on it gets ignored for so long.
Comment 27 Remy Suen CLA 2011-10-03 08:06:12 EDT
(In reply to comment #26)
> Just curious, but how do we push along bugs that don't seem to move anywhere?

EGit is no different from any other open source project so I would just do the usual thing. Ping the bug, ask on the mailing list, blog about it and draw other's attention to it so more people are commenting/CC'ing themselves on the bug, vote on the bug, etc, etc.

Of course, at the end of the day, this is open source and I can't force someone else to do anything.

> I've had a bug opened WITH a patch for more than 2 months and nobody has
> addressed it.

I think you may get more mileage if you pushed your change set to Gerrit for review.
Comment 28 Kevin Sheedy CLA 2011-12-02 09:25:05 EST
I'd like to suggest that "Commit and Push" become a top level command with it's own keybinding. This could raise the commit dialog with the Push checkbox pre-selected. This would make the commit and push truly a one step operation.

I think this is really important in order to get the SVN/CVS users on board the Git bandwagon. If I'm making 50 commits a day, I really won't want to manually click a checkbox every time.
Comment 29 Kevin Sheedy CLA 2011-12-02 09:43:44 EST
*** Bug 365406 has been marked as a duplicate of this bug. ***
Comment 30 Richard Eckart de Castilho CLA 2012-05-06 11:45:22 EDT
+1 for "commit and push". IntelliJ has such a button in the GIT commit dialog, and I like it very much.
Comment 31 Andre Dietisheim CLA 2012-08-29 11:13:08 EDT
I pushed a change to gerrit, that implements a checkbox (as shown in the screenshot) that would allow users to push to upstream when checked.

https://git.eclipse.org/r/7487
Comment 32 Andre Dietisheim CLA 2012-08-30 04:30:48 EDT
Instead of a global keybinding (which are crowded already anyhow) I'd suggest to store the checked state of the "Push changes to Upstream"-checkbox in the Eclipse preferences. This would allow you to set it once and have it checked in every upcoming commit.
Comment 33 Matthias Sohn CLA 2012-09-04 17:12:40 EDT
merged as f1550b8293315b84b476a65953555102f7e8c6d5
Comment 34 Dani Megert CLA 2012-09-06 09:34:06 EDT
Verified in 2.1.0.201209051725. Nice!
Comment 35 Sam Davis CLA 2012-09-10 18:58:29 EDT
(In reply to comment #21)
>  I guess most of the
> users will have only one remote repository.

I'm not sure that this is a valid assumption for Gerrit users. I would think having a separate remote for Gerrit is a common configuration, and having the option to push directly there when committing would be quite useful. As it stands, I have to right click > team > remote > push to Gerrit, and that only brings up a push dialog. Having a "Push to Gerrit" checkbox in the commit dialog which pushes in one step would be a lot simpler.
Comment 36 Miles Parker CLA 2012-09-13 16:58:40 EDT
I saw this today in my regular old Eclipse for the first time. It's been an epic -- thanks to everyone who contributed, commented, tested, verified, etc.. :)

The funny thing is, now that I have it, I've kind of gotten used to the git way. ;P
Comment 37 Sam Davis CLA 2012-09-13 17:02:11 EDT
Actually I'm finding this quite dangerous, because I forget that the box is checked. I think it would be better just to have a separate button to commit and push, instead of a check box.
Comment 38 Dani Megert CLA 2012-09-14 01:44:17 EDT
(In reply to comment #37)
> Actually I'm finding this quite dangerous, because I forget that the box is
> checked. I think it would be better just to have a separate button to commit
> and push, instead of a check box.

After working with this for a while I tend to agree. It turned out that in the end I had to deselect that checkbox again.
Comment 39 Andre Dietisheim CLA 2012-09-14 03:50:09 EDT
To sum up there are apparently 2 distinct usage patterns:

* people that have several commits a day and want to always push / or not to push upstream. They dont want to manually ensure the push's done on every commit (therefore the state of the checkbox is currently stored to the preferences currently)

* people that have several different commits a day that may or may not be pushed upstream. They tend to forget about the checkbox and end up pushing where they didn't want to and vice versa.

To me it looks like having a 2nd button fullfills these 2 requirements the best. The default button would still do a simple commit whereas a new button "commit and push" would do the push, too. Any thoughts? Alternatives? I'd open a new bugzilla for this change then.
Comment 40 Markus Keller CLA 2012-09-14 10:26:10 EDT
+1 for the 2 buttons approach ("Commit and Push", "Commit"). "Commit and Push" would also be useful as a separate command in the Git Staging view toolbar.
Comment 41 Miles Parker CLA 2012-09-14 12:46:07 EDT
Sam and I were talking about this a bit more yesterday. As Andre suggests, there are some workflows that work very well with current design and there are some that work not well at all.

The worst case I can think of is the "doh! I forgot to pull before pushing and now I've tried to commit a fast-forward change that's been kicked back". Then you have to do the whole dance of trying to preserve your changes reset and then commit again without borking the remote repos.

Almost all of these workflows are repository specific. If you're like me you might have some repos which are "mine" that I just want to commit and push to. There are some like Gerrit that I may want to push to immediately, but may want to batch, there are some I never want to push automatically to, and there are some like the master dev branches that I want to be sure to always pull from before pushing.

Probably the two button approach does handle all of those cases best, but OTOH it might be nice to be spared the extra cycles of having to think through that every time.

So... what about storing the preference in git config? You could do that at the repos level and/or at the global level. It might be too confusing/dangerous though because the preference default state wouldn't always be obvious. You'd have to surface that in the commit UI somehow and it would be a design challenge to do that in a way that didn't add to the confusion.
Comment 42 Sam Davis CLA 2012-09-14 13:10:28 EDT
I sill think the 2 button approach without any stored preference is best, but as Miles pointed out this functionality is less useful if the remote is a git repository that many other people are pushing to, as you normally have to pull first anyway. Would it make sense to have the button do commit, pull, and push?
Comment 43 Andre Dietisheim CLA 2012-09-17 05:54:27 EDT
(In reply to comment #42)
> I sill think the 2 button approach without any stored preference is best,

I complete agree. IMHO the 2 buttons approach is the best one so far. 

> but as Miles pointed out this functionality is less useful if the remote is
> a git repository that many other people are pushing to, as you normally have
> to pull first anyway. Would it make sense to have the button do commit,
> pull, and push?

Looks like an interesting approach. To get you right: You suggest a first button to just commit. Another one that would commit, pull and push? The push would then get skipped if the pull had merge errors, right?
Comment 44 Dani Megert CLA 2012-09-17 06:03:10 EDT
(In reply to comment #42)
> I sill think the 2 button approach without any stored preference is best,

Me too.


> but as Miles pointed out this functionality is less useful if the remote is
> a git repository that many other people are pushing to, as you normally have
> to pull first anyway. Would it make sense to have the button do commit,
> pull, and push?

I would not want too much logic here. Simple 'Commit' and 'Commit & Push' would be enough for me. I've filed bug 389708 for that. We can continue the discussion there.
Comment 45 Robin Stocker CLA 2012-09-17 06:38:00 EDT
(In reply to comment #44)
> (In reply to comment #42)
> > but as Miles pointed out this functionality is less useful if the remote is
> > a git repository that many other people are pushing to, as you normally have
> > to pull first anyway. Would it make sense to have the button do commit,
> > pull, and push?
> 
> I would not want too much logic here. Simple 'Commit' and 'Commit & Push'
> would be enough for me.

Agreed. Doing a pull in between could have many potential problems. E.g. it is possible to have a conflict-free pull resulting in non-compiling code, in which case that would be pushed.
Comment 46 Sam Davis CLA 2012-09-17 14:00:10 EDT
(In reply to comment #45)
> (In reply to comment #44)
> > (In reply to comment #42)
> > > but as Miles pointed out this functionality is less useful if the remote is
> > > a git repository that many other people are pushing to, as you normally have
> > > to pull first anyway. Would it make sense to have the button do commit,
> > > pull, and push?
> >
> > I would not want too much logic here. Simple 'Commit' and 'Commit & Push'
> > would be enough for me.
> 
> Agreed. Doing a pull in between could have many potential problems. E.g. it is
> possible to have a conflict-free pull resulting in non-compiling code, in which
> case that would be pushed.

That's a good point. There's a problem with Git's model in that even if you pull first and then push, there's a good chance somebody else will have pushed in between, in which case you have to pull again. But I guess that can't be solved purely in the UI.
Comment 47 Sam Davis CLA 2012-09-19 18:56:18 EDT
(In reply to comment #45)
> (In reply to comment #44)
> > (In reply to comment #42)
> > > but as Miles pointed out this functionality is less useful if the remote is
> > > a git repository that many other people are pushing to, as you normally have
> > > to pull first anyway. Would it make sense to have the button do commit,
> > > pull, and push?
> >
> > I would not want too much logic here. Simple 'Commit' and 'Commit & Push'
> > would be enough for me.
> 
> Agreed. Doing a pull in between could have many potential problems. E.g. it is
> possible to have a conflict-free pull resulting in non-compiling code, in which
> case that would be pushed.

Actually, the same thing can happen when Gerrit automatically rebases a patch set before pushing it, but the automatic rebase is still a very useful feature. So I still think this could be worth having.
Comment 48 Matthias Sohn CLA 2013-04-10 09:31:02 EDT
*** Bug 389593 has been marked as a duplicate of this bug. ***