Tracking the upstream branch in git

This is more for me than for you. I love Git, but some of the most useful commands are incredibly idiosyncratic, involving various flags or punctuation ("git push remote :branch-you-want-to-remove" to delete a branch, anyone?) in order to carry out something that really isn't that uncommon to want to do.

Okay, so whenever I add or checkout a branch, I usually want to configure Git to know about the relation. Usually I end up opening up my .git/config file and adding the lines manually:

[branch "branch-name"]
 remote = origin
 merge = refs/heads/branch-name

However (as a quick google search will also turn up), as of Git v1.7, you can "simply" type:

git branch --set-upstream branch-name origin/branch-name

It doesn't save you all that much typing, I suppose, but I like not having to involve the editor in such a common task (and you can always alias it to make it easier to recall). That's it. If the act of writing it down doesn't force me to remember, at least now I can save myself the google-fu in order to re-discover the syntax!