Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase branch onto its base branch #3546

Open
stefanhaller opened this issue May 3, 2024 · 1 comment
Open

Rebase branch onto its base branch #3546

stefanhaller opened this issue May 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@stefanhaller
Copy link
Collaborator

Once we have done #3536 and we have an easy way to see how a branch diverges from its base branch, the logical next wish is to rebase it onto the base branch. Right now you have to find the base branch yourself in the branches list, press f on it if it isn't up to date, and then press r to rebase onto it. (Alternatively, you can select the base branch and press u r to rebase onto its upstream, so you don't have to bring the local branch up to date. It's the same number of keystrokes though.)

Since this is a frequent operation, it should be simpler. I should be able to rebase onto origin/main without having to bring main up to date, and also without having to remember whether my feature branch sits on main, devel, or 1.7-hotfixes.

A "rebase onto base branch" command is easy enough to implement once we have the the supporting code from #3536 in place, but I find it tricky to decide which menu it should be added to: it could be the rebase menu or the upstream menu, I could go with either. However: there's already the "rebase onto upstream" command in the upstream menu, which means this new one should go next to it. But then, it's difficult to come up with a keybinding that's mnemonic and easy to remember. Also, I don't really want three keystrokes for rebasing onto the base branch; for rebase onto upstream, it is currently u r enter because it lets you decide between normal and interactive rebase. I don't think we need this, it should be normal rebase by default to save a keystroke, and if you do want an interactive rebase you can still do it the old way (by selecting main, pressing f if needed, and r i).

So I'm thinking we could maybe live with the inconsistency of having "rebase onto upstream" in one menu and "rebase onto base branch" in another. So we'd add it to the rebase menu, and have it start a normal rebase.

Actually, I'm wondering what the "rebase onto upstream" command was added for; I'm having trouble coming up with use cases other than rebasing onto the base branch, for which we are adding an easier way here, so could it be an option to remove that command again for clarity?

Ping @jesseduffield.

@stefanhaller stefanhaller added the enhancement New feature or request label May 3, 2024
@jesseduffield
Copy link
Owner

I agree it would be good to have a quick way to rebase onto a base branch. And I agree putting it in the rebase menu makes sense.

Actually, I'm wondering what the "rebase onto upstream" command was added for; I'm having trouble coming up with use cases other than rebasing onto the base branch, for which we are adding an easier way here, so could it be an option to remove that command again for clarity?

I believe rebase onto upstream is there for completeness i.e. to spare users from having to perform the same action via the remote branches view. Do we actually need to remove it though? It's not clear to me that its existence causes any confusion given that it is upstream-specific and lives in an upstream-specific menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants