This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 248334 - Add rebasing to branch context menu in the repository browser
Summary: Add rebasing to branch context menu in the repository browser
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 8.0.1
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-01 12:20 UTC by hifi
Modified: 2014-11-12 06:32 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hifi 2014-11-01 12:20:48 UTC
When working with many people, I keep fetching the remote branches from time to time to know what others are doing and be prepared to merge/rebase. However, when the time comes to publish my commits and rebase them against origin so I don't need to make a merge commit, the context menu for branches doesn't have an option to rebase, only merge.

The only way to access rebase is to go through the full repository git menu which also requires you to select the branch you want to rebase against.

For me, the best shortcut would be 'Rebase onto "origin/branch"' in the current branch context menu when tracking is enabled.
Comment 1 Ondrej Vrabec 2014-11-03 07:25:11 UTC
There's already the Sync with origin/master action which fails in case of a needed merge/rebase. I suggest that instead of adding another action we enhance this one and let it display an offer "Do you want to Merge / Rebase" dialog allowing you to make the full sync. Something that is offered when you're doing a pull. Any objections?
Comment 2 hifi 2014-11-03 08:57:28 UTC
You talked about pulling, but I never pull. I always fetch because in git context pulling *always* means a forced merge with the cli tool, so the behavior of that shouldn't be changed from unconditional merge to dialog giving you 3 options (merge, rebase or do nothing). Right?

Also, in my flow I fetch multiple times without merging/rebasing, just to keep myself in the know of what other people are doing, so regardless I'd need to go through the main git menu to do the rebase in the end.

Not sure what would be the best option to be honest if adding it to the context menu would seem superfluous.
Comment 3 Ondrej Vrabec 2014-11-03 09:13:24 UTC
(In reply to hifi from comment #2)
> You talked about pulling, but I never pull. I always fetch because in git
> context pulling *always* means a forced merge with the cli tool, so the
> behavior of that shouldn't be changed from unconditional merge to dialog
> giving you 3 options (merge, rebase or do nothing). Right?
Why not? Not always does git pull only a merge, if you set "pull.rebase=true" in config then it actually does a rebase instead of merge. So we let user to choose between the two.
> Also, in my flow I fetch multiple times without merging/rebasing, just to
> keep myself in the know of what other people are doing, so regardless I'd
> need to go through the main git menu to do the rebase in the end.
Sure, i understand. I didn't say i would break your workflow.
> Not sure what would be the best option to be honest if adding it to the
> context menu would seem superfluous.
What i was trying to say was that having two actions one under the other:
"Sync with origin/master"
"Rebase on origin/master"
is useless and only makes the popup menu larger and harder to orient in. So in case you choose Sync action manually, it could offer you to do either merge or rebase if it's the current branch, right?
Comment 4 hifi 2014-11-05 07:59:42 UTC
(In reply to Ondrej Vrabec from comment #3)
> (In reply to hifi from comment #2)
> > You talked about pulling, but I never pull. I always fetch because in git
> > context pulling *always* means a forced merge with the cli tool, so the
> > behavior of that shouldn't be changed from unconditional merge to dialog
> > giving you 3 options (merge, rebase or do nothing). Right?
> Why not? Not always does git pull only a merge, if you set
> "pull.rebase=true" in config then it actually does a rebase instead of
> merge. So we let user to choose between the two.

People are taught not to do pull because it does that. Changing it to do that would be the right thing but that's not what git normally does. Now everyone would need to be taught that instead in NetBeans you always pull because it asks you what you want to do instead of completely screwing your branches and killing kittens.

> > Also, in my flow I fetch multiple times without merging/rebasing, just to
> > keep myself in the know of what other people are doing, so regardless I'd
> > need to go through the main git menu to do the rebase in the end.
> Sure, i understand. I didn't say i would break your workflow.

I didn't imply you would, sorry if you thought I did. I just said that this is what I need to do currently and that it is a fairly long road.

> > Not sure what would be the best option to be honest if adding it to the
> > context menu would seem superfluous.
> What i was trying to say was that having two actions one under the other:
> "Sync with origin/master"
> "Rebase on origin/master"
> is useless and only makes the popup menu larger and harder to orient in. So
> in case you choose Sync action manually, it could offer you to do either
> merge or rebase if it's the current branch, right?

What you suggested here and referenced in bug 248332 would seem like a reasonable approach to both issues when doing a fetch and when auto-sync is enabled as then I can always just decline the suggestion and if someone doesn't want that they can disable auto-sync and fetch will just update remotes without any dialogs.
Comment 5 hifi 2014-11-05 09:43:13 UTC
Actually my answer was half-complete. It doesn't solve the "rebase at any random point in time against the remote tracked branch" issue which was the original thing that leads through the long git menu unless the "Sync with remote/branch" option is enabled at all times and would suggest to rebase/merge if fast-forward isn't possible and it would work even with the current active branch.
Comment 6 Ondrej Vrabec 2014-11-07 17:23:54 UTC
I did as i proposed. Now there is the action "Sync with origin/master" all the times enabled. If a merge or rebase is needed user is asked to choose between the two and the command will continue.
Back to your original request: you requested a rebase on "origin/master" kind of action. With my fix you will get the same if you choose "Rebase" in the dialog.
I am sorry i got lost in the comments so i am not sure you'll be happy with this. If you actually request someting else, reopen and explain in detail once more, thanks.

fixed: core-main #aada9ab3df5a
Comment 7 Quality Engineering 2014-11-08 10:59:35 UTC
Integrated into 'main-silver', will be available in build *201411080653* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/aada9ab3df5a
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: Issue #248334 - Add rebasing to branch context menu in the repository browser
Allow synchronize of the current branch. If a merge is needed, user is asked to continue
with either merge or rebase.
Comment 8 hifi 2014-11-10 06:05:28 UTC
The fix sounds like a good solution. I'll get around testing it once I hit this at work with the current nightly.
Comment 9 hifi 2014-11-12 06:32:36 UTC
I finally hit a point where I had to rebase the current checked out branch and it was rather painless using the updated sync option which allowed doing that while checked out and offered rebasing as an option.

Thanks!