git-machete-intellij-plugin icon indicating copy to clipboard operation
git-machete-intellij-plugin copied to clipboard

Global keyboard shortcut for interactive rebase to parent

Open CLOVIS-AI opened this issue 2 years ago • 6 comments
trafficstars

This is a feature proposal. Sorry for the noise with the 'bug' label, but there is no 'new feature' template at the moment.

Feature proposal

Currently, the plugin creates a "Git Machete: Sync Current Branch to Parent by Rebase" action that I can assign a shortcut to in Settings -> Keymap.

However, that shortcut only works when the focus is in the Git Machete tab in the Version Control view. I would like it to work even when the focus is in the editor.

Use case description

When writing code, I regularly create temporary commits to fix errors in previous commits of the same branch. Afterwards, I rebase the branch to fixup these temporary commits.

Before using Git Machete, I used the Rebase action by default in IDEA. It opens a small dialog which allows the select rebasing options (--onto, --rebase, the target branch, etc) and rebases the current branch using the selected settings. However, this dialog is not aware of the dependency relationships between branches, and will by default rebase a branch with all its dependencies.

The Git Machete action "Sync to Parent by Rebase", available when right-clicking on the current branch in the Git Machete tab is exactly the behavior that fixes the above issues (it sets the target branch, --interactive and --onto automatically). However, currently, it is only possible to access it by opening the Git Machete tab (by shortcut), selecting the current branch (by mouse), accessing the contextual menu (right click) and finally selecting the operation.

Instead of all of this, I would like to be able to set a keyboard shortcut that I could invoke from anywhere in the IDE, to call this action on the current branch.

CLOVIS-AI avatar Dec 04 '22 15:12 CLOVIS-AI

Hello again @CLOVIS-AI 👋 Thank you for such specific description 🚀 This is good idea, it should not be hard to implement it however it requires some research on how to do that 👨‍🔬

Currently we have a bit less time for this project but I can guarantee you that externally requested features have a high priority for us ❗

mkondratek avatar Dec 04 '22 15:12 mkondratek

As an added bonus, please create a shortcut for 'traverse to here' too :)

By the way, it's amazing the amount of time saved by this plugin.

CLOVIS-AI avatar Jan 12 '23 09:01 CLOVIS-AI

Actually... this should be pretty easy for us to implement, expect it soon 📦

PawelLipski avatar Jan 12 '23 09:01 PawelLipski

Just as a clarification:

The Git Machete action "Sync to Parent by Rebase", available when right-clicking on the current branch in the Git Machete tab is exactly the behavior that fixes the above issues (it sets the target branch, --interactive and --onto automatically). However, currently, it is only possible to access it by opening the Git Machete tab (by shortcut), selecting the current branch (by mouse), accessing the contextual menu (right click) and finally selecting the operation.

Note that currently it's also possible to trigger the Sync Current Branch to Parent by Rebase action in two other ways:

  • via ✂️ button in Git Machete's tab in Git tool window: image
  • via Action Search (Ctrl/Cmd+Shift+A): image

PawelLipski avatar Jan 12 '23 15:01 PawelLipski

Also, you can use (Ctrl/Cmd)+Shift+Alt+M shortcut for opening the Git Machete tab.

Still, there is an underlying issue for global shortcuts not working... #1445 🐞

PawelLipski avatar Jan 12 '23 18:01 PawelLipski

Yeah, supporting such global shortcuts would require quite a major architectural redesign as you can see (#1445) 😅 it isn't out of question... but given that we won't have anybody full-time in this project anytime soon, it won't happen quickly :/

In the meantime @CLOVIS-AI, the closest you can get to your desired functionality is to:

  • assign some (Cmd/Ctrl)+Shift+Alt+<letter> (Cmd for Mac, Ctrl for Lin/Win) shortcuts to the actions of your choice, like rebase or traverse
  • use the sequence (Cmd/Ctrl)+Shift+Alt+M, (Cmd/Ctrl)+Shift+Alt+<letter> to open the tab and fire the action

Note that I've suggested (Cmd/Ctrl)+Shift+Alt+<letter>, as the built-in shortcut for opening Git Machete tab ((Cmd/Ctrl)+Shift+Alt+M) already uses this combination of functional keys; hence it's easy to fire one after another in sequence 🎹

PawelLipski avatar Jan 12 '23 19:01 PawelLipski