SourceTree Keyboard Shortcuts

Originally (back in 2015) this post was a record of my attempts to brute force the discovery of Sourcetree keyboard shortcuts, because they were not well-documented by Atlassian (or anyone else I could find at the time).

Now, in 2020, the keyboard shortcuts are readily available both in-program (on each context menu item) as well as a few easily located resources online. So I’ll repurpose this blog post instead to surface some of the more useful keyboard shortcuts (this list is no longer exhaustive), and explain how I extend the keyboard shortcuts Sourcetree provides natively.

These are the Mac keyboard shortcuts (although I suspect the Windows equivalents are more often than not, the same but with ctrl instead of cmd).

Navigation & Menus

Action Shortcut
File Status Screen cmd + 1
History Screen cmd + 2
Search Screen cmd + 3
New repo cmd + n
Hide/show sidebar cmd + shift + k
Repository details cmd + shift + i
Open file browser (fastest way to switch repositories) cmd + o

Staging & Commit Operations

Action Shortcut
Commit All… Screen cmd + shift + c
Commit options cmd + shift + o
Reset Selected File cmd + shift + r
Diff cmd + d
Remove Selected File cmd + delete
Search cmd + shift + h
Refresh cmd + r

Removing and resetting files

Action Shortcut
Delete cmd + delete
Reset file to staged version cmd + alt + R

Find

Action Shortcut
Find (file by name or path) cmd + f
Find Next cmd + g
Find Previous cmd + shit + g
Use selection to find cmd + e

Branch Operations

Action Shortcut
Stash cmd + shift + s
Add or Remove Tag cmd + shift + t
Branch cmd + shift + b
Merge cmd + shift + m

Repository Operations

Action Shortcut
Fetch cmd + shift + f
Pull from repository cmd + shift + l
Open remote in web browser cmd + shift + w
Open pull request cmd + alt + p

Window (Normal Mac Shortcuts)

Action Shortcut
Quit cmd + q
Close window cmd + w
Hide cmd + h
Minimise cmd + m
Settings cmd + ,
Undo Cmd + z
Select All Cmd + a
Emoji & Synbols Cmd + ctrl + space

Creating your own keyboard shortcuts

Sourcetree is no different than any other Mac application, in that you can define your own keyboard shortcuts for system menu items.

Identify the menu item that either has no keyboard shortcut, or one that you don’t like, and take note of its name.

Open System Preferences, select the Keyboard option, then the Shortcuts tab, followed by the App Shortcuts menu item. Click the + button, Select Sourcetree as the Application, your menu name as Menu Title and define your keyboard shortcut. Close System Preferences and reopen Sourcetree to use.

Going beyond pre-defined actions and navigating menu items

I use Vimac to navigate the parts of the Sourcetree UI and perform actions that do not have convenient keyboard shortcuts or menu items.

It provides the following keyboard shortcuts (each is configurable):

Action Shortcut
Activate ctrl + space
Right click Hold shift when typing macro
Double click Hold cmd when typing macro

There are alternatives such as Keyboard Maestro (Paid software) that may be better suited to your preferences.

Related


Comments