-2

Intellij's git integration has a "rebase current onto selected" and a "merge into current" operation in its context menu.

Is it possible to reverse the direction somehow, to (also) have "rebase selected onto current" and "Merge current into selected" options available?

That would cut down on checkout operations.

Actually, even being able to reverse the direction of one would already be great, because they feel inconsistent to me, one being the opposite of the other.

drdeath
  • 81
  • 1
  • 11
  • I know perfectly well that if I'm on B and I want to merge B into A, I can just switch to A and merge B, but can I do it _without_ the added hassle of switching to A first? – drdeath Jun 30 '21 at 15:10
  • You know what? Never mind.... I actually didn't understand fully the two options you provided there. Let me delete my comment. – eftshift0 Jun 30 '21 at 15:55
  • "Merge current into selected", if it existed, would require a checkout (because git would need to start working on _the other branch_, hence a checkout). What you would like to avoid is you manually having to checkout, I would assume? – eftshift0 Jun 30 '21 at 15:57
  • @eftshift0 you assume correctly. It would simply be a bit of convenience. – drdeath Jul 02 '21 at 08:23

1 Answers1

1

Git must checkout the branch being rebased or being merged into. This is a git requirement, not an IntelliJ limitation.

Type git help rebase if you don't believe me ;)

If you think about it, it makes sense. If Git needs to operate on the files of a branch, it needs to first check them out.

So, no, you CANNOT "cut down on checkout operations". The most you can do is cut down on the clicks using the command: Checkout and Rebase onto Current.

Inigo
  • 12,186
  • 5
  • 41
  • 70
  • I know how rebasing works, and I'm not talking about the underlying git functionality, but about how Intellij leverages it. I'm a lazy bastard who wants to have all options presented on a silver platter. – drdeath Jul 01 '21 at 13:50
  • Doesn't sound like you actually read what I wrote, or understood it. IntelliJ CANNOT avoid doing the checkout. And I gave you the closest thing to the silver platter possible in the last sentence. Or do you in addition want IntelliJ to save you a click and switch back to the original branch when it's done? – Inigo Jul 01 '21 at 18:02
  • I did read what you wrote, and I did understand it. Actually, I know quite a lot about the inner workings of git, and I even understand WHY git needs to check out before it can rebase. BUT! The integration of Intellij is a convenience tool anyways, tooled to make the often confusing git options more accessible. In some places it already packages multiple git commands into one. I was kinda hoping there might be a plugin or option that makes it do some more of that. – drdeath Jul 02 '21 at 08:20
  • @drdeath: if you snip the tags down to just `intellij-idea` and maybe `intellij-plugin`, you probably won't get Git-oriented answers like this. (There's probably still no shortcut *in* IntelliJ; I have no idea as I don't use it.) – torek Jul 02 '21 at 09:42
  • In any case @drdeath, I provided you with an accurate answer. Your only other options are to (a) submit a feature request or (b) write a plugin. The later isn't hard to write, the biggest pain is setting up the dev and build environment for plugins. They do provide a template to make it easier: https://github.com/JetBrains/intellij-platform-plugin-template – Inigo Jul 02 '21 at 15:47