GitHub pull requests and issues

I have resisted using pull requests on GitHub for my own repositories because it seemed like I need to have have both an Issue and a Pull Request for each branch. I create Issues for fixes and features that I want to implement. During development I create a branch for the Issue and then once it’s finished and tested I manually merge with a merge commit and use the message of the merge commit to close the Issue.

Recently I came across an article about converting a GitHub Issue to a Pull Request. This solved my issue of having both an Issue and a Pull Request for each feature. I can create my Issues like normal and create a branch. Then when I push the branch I execute the following:

hub pull-request -i <issue number> -b main

This converts the specified Issue number into a Pull Request and associates it with the current branch. I need the “-b main” because I have my push.default value set to “nothing” and it appears that “hub” can’t find the main branch with that setup.

I’ve found a couple of benefits of using this pattern. One is that I can merge pull requests using the GitHub mobile app on my phone. The other is that now it’s really easy to review the changes made for a feature and keep the discussion about the issue in the same place.