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…