Speed up your development workflow with gh
+ fzf
!
I use GitHub’s command line interface, gh
, on a daily basis to interact with my repositories and organizations on GitHub. It’s a powerful tool that allows me to do things like search for pull requests and issues, create and edit issues, and even perform code reviews all from the command line.
To make using gh
even more efficient, I use functions and aliases. I recently bundled all of them into a zsh plugin cbrgm/gh-fused which includes several functions and aliases that use gh
to search for pull requests and issues, and allows me to open them in a web browser. These functions and aliases allow me to quickly search for and access the pull requests and issues I need, without having to switch to a web browser or manually type out long gh
commands.
Introducing cbrgm/gh-fused!
gh-fused
is a collection of powerful aliases that combine gh
and fzf
to speed up interactions with GitHub. It’s purpose is to be a CLI clone of github.com/pulls and github.com/issues and it can do so much more!
To use gh-fused
, you’ll need to have fzf
, gh
, gnu core utils
, and jq
installed on your machine. Once you have these tools installed, you can download the ghfused.source
file and add it to your .bashrc
or .zshrc
file. Alternatively, you can install ghfused
using a ZSH plugin manager.
Once gh-fused
is installed, you can use it to search for pull requests, issues, and repositories using fuzzy search with fzf
. There are also several aliases that allow you to search for specific types of pull requests and issues, such as those created by the current user or those that have review requests wanted from the current user.
In addition to the gh-fused
aliases, you can also use all of the options that gh search repos/issues/prs
supports, with the exception of --json
and --template
, which are utilized by gh-fused
.
What are these aliases you’re talking about?
The ghspr
function uses gh
to search for pull requests, and displays the results in a formatted table using the fzf
command line fuzzy finder. This allows me to easily find the pull request I am looking for by searching through the results. The ghspr
function also includes several keybindings that allow me to open the pull request in a web browser, view the diff in a web browser, toggle the preview window, unassign myself from the pull request, or assign myself to the pull request.
The ghsi
function is similar to ghspr
, but searches for issues instead of pull requests. It also includes keybindings that allow me to open the issue in a web browser, toggle the preview window, unassign myself from the issue, or assign myself to the issue.
cbrgm/gh-fused also includes several aliases that use the ghspr
and ghsi
functions with different arguments to search for specific types of pull requests and issues. The ghpr
alias searches for open pull requests created by me, the ghpra
alias searches for open pull requests assigned to me, the ghprm
alias searches for open pull requests with mentions of me, and the ghrr
alias searches for open pull requests with review requests wanted from me.
Conclusion
Overall, these functions and aliases are an excellent tool for me to speed up my workflows when interacting with GitHub from the command line. They allow me to quickly search for and access the pull requests and issues I need, without having to switch to a web browser or manually type out long gh
commands. This can save time and improve my productivity as a developer, making it an awesome tool to have in my toolkit.