Some nice git helpers to feel at home in the terminal
16 Feb 2026
2 min read
Prerequisites
fzf
You can install it easily by following the instructions. Simple brew install fzf on a Mac and then adding source <(fzf --zsh) line to the .zshrc file will do the job.
Fzf is really great for multiple things but you can read about that on your own because that’s not the point here.
GitHub CLI
Again, you can read the installation instructions here. On Mac it comes down to simple brew install gh and then gh auth login.
I don’t particularly like the gh cli for everything, but for simple stuff like listing PRs it really comes in handy.
Now on to the main thing.
Fuzzy checkouts
It’s a simple function that can be added to the .zshrc (or your shell of choice configuration file):
fo() {
git branch --no-color --sort=-committerdate --format='%(refname:short)' | fzf --header 'git checkout' | xargs git checkout
}
Here’s the end result:
Fuzzy PRs
And finally, here’s a similar script for listing PRs in the same way:
po() {
gh pr list --author "@me" | fzf --header 'checkout PR' | awk '{print $(NF-5)}' | xargs git checkout
}
Notes
These helper commands are all part of an amazing article by Thorsten Ball that shaped the way that I use git since the first time I’ve read it.