Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Shortcut for branch switching?
Shortcut for branch switching? [message #1835433] Thu, 03 December 2020 09:48 Go to next message
Max Muster is currently offline Max MusterFriend
Messages: 11
Registered: November 2020
Junior Member
Hi,

one can use

Git Repository View -> Right Click -> Switch To -> Other...

to switch to antother branch. Is it possible to add a shortcut for this? I looked at

Preferences -> General -> Keys -> Type "branch"

But I couldn't see an option for "Switch To -> Other"

Best regards
Re: Shortcut for branch switching? [message #1835456 is a reply to message #1835433] Thu, 03 December 2020 17:24 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
My solution to this problem applies in other places also. I strive to optimize my keyboard usage, so I pay attention to this a lot. Unfortunately, there is no direct shortcut for this.

I bound "Ctrl+; ." to "show-context-menu". That's Ctrl-semicolon, then "." (period). This presents the context menu, with nothing selected. Pressing "downarrow" at this point selects the first menu item, which is "Switch To". Now press "rightarrow" to expand the menu for "Switch To". That opens the menu, with "New Branch..." selected. Press "uparrow", which goes to the bottom of the menu, which now selects "Other...".

It sounds complicated, but it's very easy to get used to.

I use "Ctrl+;" as a common prefix for several functions that are either not typically bound, or for which I want a more convenient shortcut for. I also use the "Emacs+ plugin, which provides quite a few other convenient functions that don't come by default.

Re: Shortcut for branch switching? [message #1835469 is a reply to message #1835456] Thu, 03 December 2020 22:54 Go to previous messageGo to next message
Max Muster is currently offline Max MusterFriend
Messages: 11
Registered: November 2020
Junior Member
Thanks for the tip, it works!

The git repository has to be in focus / clicked at before, though, doesn't it? That to me reduces a bit the help of this trick - if I'm already clicking on it with a left click, I could also right click instead and then navigate with the keys - or am I missing something?

It would be cool if I didn't have to click at the repository actively before.

Do you think it would make sense to submit a feature request to allow having a shortcut for switch to new / other branch or is it unlikely to be implemented?

[Updated on: Thu, 03 December 2020 22:55]

Report message to a moderator

Re: Shortcut for branch switching? [message #1835472 is a reply to message #1835469] Fri, 04 December 2020 00:40 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
The flaw in your logic is that you most likely will have more than one repository in the Git Repositories view. I have dozens. So if you had this shortcut, which repository would it operate on? If you say "the one I have selected", then that will do little more than what I just described.

If you already have one repository selected, then uparrow or downarrow moves the selection.

If you don't even have the Git Repositories view in focus, use the key bound to "find-actions" (I have "Ctrl+3") and type the minimum to match "Git Repositories" (like "repos") and press Enter.
Re: Shortcut for branch switching? [message #1835480 is a reply to message #1835472] Fri, 04 December 2020 08:24 Go to previous messageGo to next message
Max Muster is currently offline Max MusterFriend
Messages: 11
Registered: November 2020
Junior Member
The shortcut could operate on the Git Repository which was actively clicked on the last time, couldn't it?

What I mean is that if I'm in the editor writing code one of the repositories still is selected (light blue (instead of dark blue when it is in focus by clicking on it)). I think that's the one I had in focus last stime, isn't it?

[Updated on: Fri, 04 December 2020 08:25]

Report message to a moderator

Re: Shortcut for branch switching? [message #1835492 is a reply to message #1835480] Fri, 04 December 2020 16:38 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
That could technically work. Nothing wrong with creating a feature request.
Re: Shortcut for branch switching? [message #1835501 is a reply to message #1835492] Fri, 04 December 2020 22:53 Go to previous message
Max Muster is currently offline Max MusterFriend
Messages: 11
Registered: November 2020
Junior Member
Thanks, will do it!
Previous Topic:How to read linked Eclipse files?
Next Topic:I got a problem when I link mysql with eclipse, Unsupported character encoding 'MacCentralEurope'.
Goto Forum:
  


Current Time: Thu Apr 25 16:21:25 GMT 2024

Powered by FUDForum. Page generated in 0.03394 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top