Eclipse shortcuts for common SVN commands

When working with SVN, CVS or any other repo, there are some things you’ll just do over and over again. Things like committing files, comparing files and viewing a file’s history are all commonplace actions.

So you might be wondering where the keyboard shortcuts for these actions are, because,  as I mentioned before, you normally work faster with keyboard shortcuts than jumping between the mouse and keyboard all the time. And often the longest part about working with repos is guiding your mouse through treacherous context menus and submenus.

The good news is that there are keyboard shortcuts in Eclipse for the most common repository commands (and not-so-common as well). The bad news is that most of them aren’t configured by default, so you need to set some of them up beforehand. But the 2 minutes spent configuring these may save you hours in the long run.

I’ll be using SVN as the example repository (using Subclipse) but these should apply to your favourite repository integrated into Eclipse (I know that the in-built CVS has these commands as well).

Common SVN keyboard shortcuts

So, here are the keyboard shortcuts you can configure and some suggestions for what to set them to. In summary, go to Window > Preferences > General > Keys, then use the Command colum below to search for the SVN command you’re interested in. But have a look at how to manage keyboard shortcuts for more details about configuring shortcuts. If you don’t like the suggested shortcut, you can, of course, choose any shortcut you like.

Note: None of these shortcuts are configured by default – you have to configure this yourself. Also, in the description, a resource can refer to a file, folder or project, including the active editor.

Also, Eclipse 3.6 (Helios) introduced a bug that disables the SVN keyboard commands by default. You have to enable these manually: Right-click on the toolbar and select Customize Perspective. Then go to Command Group Availability and in the Available command groups select the SVN option. This is probably still in 3.7 (see this Subclipse bug and this Eclipse bug for more details).

Suggested Shortcut Command Description
Alt+Shift+Y, C Commit Opens the commit dialog so you can commit the selected resource. Combined with shortcuts for navigating to and opening selected resources in the Package Explorer, you can commit anything easily using the keyboard.
Alt+Shift+Y, Y Compare with Latest from Repository Compares the selected resource with the latest version in SVN. I use this all the time.
Alt+Shift+Y, H Show History Opens the selected resource in the history view and displays the latest version control history for the resource. Very, very handy shortcut.
Alt+Shift+Y, S Show View (View: Synchronize) Navigates to the Synchronize View from where you can do updates and commits.
Alt+Shift+Y, U Update Updates the selected resource with the latest changes in SVN.

Be sure to configure the shortcut for the right repository. Eg, in the image below, there are two entries for commit, one for each of the repositories registered with Eclipse. Since I’m using Subclipse, I’m interested in the SVN category.

Depending on what you work with, you might want to consider other commands as well, such as Compare with Local Base Revision, Merge and Show Annotation.

Shortcuts for doing comparisons

Using shortcuts in the comparison editor can also make you work a lot faster. Note that you don’t have to configure the first two as they are configured by default.

Shortcut Command Description
Ctrl+. Next Moves to the next change in the comparison editor. Also navigates to the next file in the Synchronize View but only if this view had focus initially when opening the comparison editor. Already configured.
Ctrl+, Previous Moves to the previous change in the comparison editor. The same note above about the Synchronize View applies. Already configured.
Ctrl+Shift+< Copy from Right to Left Copies the selected change from the right (normally repository file) to the left (normally your local file). Not configured by default.

These shortcuts replace the up/down arrows you’ll see in the comparison editor, eg. as in the image below. Pressing Ctrl+./Ctrl+, will move to the next change and select it so you can either edit it or copy the change from right to left.

Related Tips

These tips should help working with SVN and code in general a lot easier:

Support Eclipse On E

4 thoughts on “Eclipse shortcuts for common SVN commands

    • Glad I could help, Iain. Yes, you’re absolutely right about having to enable it in Helios.

      I’ve got it set up on my machine but forgot to update the post. I’ll do that soon but the StackOverflow link should help anyone out in the meantime (thanks for that).

  1. Two remarks:
    – you still have to enable it in Juno as well
    – I also configured Alt + Shift +Y A to show the annotation from SVN. Showing it in Quick Diff is a very useful feature.

Leave a Reply

Your email address will not be published. Required fields are marked *