First you need to install Stacked Git.
If you are on ubuntu you can easy install it by typing in terminal
sudo apt-get install stgit
Fetching the Drupal repository
$ stg clone git://git.drupal.org/project/drupal.git
This actually fetches the whole Drupal history, including all branches and tags, not only a copy of HEAD. So you can disconnect and do all your work offline.
Creating a patch
You are now ready to manage your patch series. By convention, use this naming pattern: [nid]-[brief-description].
The generic procedure is:
// Tell Stacked Git you want to create a new patch.
$ stg new <your patch name>
// Make your modifications in the tree. `stg show` will show your diff
// ...
// Tell Stacked Git to refresh the patch (ie. to commit the modifications you made in the patch).
$ stg refresh
Managing patch series
stg series
Show the full patch series.
stg push [<patch name>]
Apply one patch from your series in your working copy.
stg pop [<patch name>]
Unapply one patch from your working copy.
stg sink [<patch name>]
Sink a patch (move it down in the series).
stg float [<patch name>]
Float a patch (move it up in the series).
Updating your patches from upstream
stg pull
Will update your repository and all the patches in your series. Some modifications may conflict, and you will have to resolve those yourself (stacked git is great, but can't read your mind).
Exporting patches for Drupal
stg export -p -O --no-prefix
Will create a patches-<branch name>
directory with all your patches, and a nice series
file.