Switching git branches faster on command line

I first started with an alias in my .bash_profile

The drawback was that although it is shorter, it doesn’t give you suggestions based on existing branches when pressing “tab” (same as unix commands work for folders/files). Git checkout command does.

So I created an alias to checkout develop.

But I wanted to use it for any branch…

Then I wrote a script (see below) and added another alias

The script does a git checkout for a first branch that matches the first script argument

Full example:

And here is the script – git-checkout-fuzzy.sh:

Enjoy and please let me now in the comments below if you find it useful and it works for you.

UPDATE: In IntelliJ it is probably better to set a keyboard shortcut for VCS > Git > Branches…

Switch windows with keyboard on Mac OS X

Very nice option to switch windows is Contexts app. It allows you to switch applications using Alt+Number. It provides a sidebar with all running apps and ability to replace Cmd+Tab including smart search through currently opened windows.

Switch with search to any window
Switch with search to any window

However I often prefer to use a keyboard shortcut that doesn’t change – for example Alt+x for XCode and Alt+c for Google Chrome. BetterTouchTool is very handy for this. Just create a keyboard shorcut, use Execute Terminal Command action and put configure it with similar command: