I spend a lot of time in the command line, especially when dealing with git commands.
My usual workflow is to stage the files I’ve been working on.
git add <files>
Then commit those changes using the following command which allows me to add a commit message using the
git commit -m "message"
And finally push that commit or group of commits to github.
git push origin <branch>
From here, I’ll switch over to Github in my browser and create a pull request when I’m ready.
I’ve been looking to optimise this process for a while and that’s when I discovered Github’s hub CLI Tool. It basically wraps the Git CLI and adds extra Github specific functionality.
All you do is install it, then alias
git in your
.bashrc or shell specific equivalent so that all your git commands now go through hub.
Now you have access to
git pull-request which will open a text editor so you can provide a pull request message and then provide you with a link directly to the pull request you’ve just made on Github where you can add reviewers and labels etc.
You can add these extra bits to your PR from the CLI tool using some flags as follows.
git pull-request -l my-label -r @team/reviewers
And if you dont want to alias git, you can access this feature and more using
hub pull-request instead.