Here are all the commands, starting from creating a new copy of a drupal repository and up to creating the patch to be published in the issue queue, the examples are for drupal core but the same may apply to contrib modules and themes too.
Get the codegit clone --branch 8.x http://git.drupal.org/project/drupal.git
Change directorycd drupal
Create a branchgit checkout -b branchnme
e.g.git checkout -b 766458-seven-rtl-112