Having a good workflow is important. A workflow that is repeatable and consistent makes your life easier.
I create a branch for every Drupal core issue that I work on and use the issue’s node id as a branch name. For example:
git checkout -b 2284103
This system has many advantages, especially if you work on multiple patches. It’s also quite easy to implement. If you are reading an issue on Drupal.org, you already have the branch name. From there, it’s as simple as copying and pasting from the url. If you have git shell completion installed, you can change your command prompt so that you know which issue you are working on by glancing at the terminal prompt.
The command line is one of the most powerful tools that we have. Learning how to alias commands and join commands together is key since it allows you to automate the process of opening your browser and navigating to the issue at hand. To do this, add the following line to your .bashrc or .bash_profile file:
alias issue="open /Applications/Google\ Chrome.app https://www.drupal.org/node/\$(git symbolic-ref -q HEAD 2>/dev/null | sed 's/^refs\/heads\/\([0-9]*\).*/\1/')"
Why do I use sed and a regular expression? If I am working on multiple versions of the same patch, I add a string to end of the name to differentiate them.
When you are working on the command line and you’ve just prepared a patch for Drupal 8 by doing the following, you can simply type “issue” to open your browser exactly where you want to be.
git diff 8.x HEAD > 2284103.40.patch
If you are repeating the same set of actions frequently, you should use scripts like these to save time.
Thanks to @xjm for tweaking the alias, regular expression and the blog title.