Deal with not-yet-existing branches correctly and add a retry decorator

Fix a small bug which did not check if a branch existed before attempting
to get the latest commit on that branch.

A @retry decorator implements logic for when to retry an API operation.
Currently an operation is retried once if a 502 Gateway Timeout is
returned.

Each method on GithubWriter that does an API call now has the @retry
decorator.  This means that methods that use various API calls (such as
create_or_update_file) will retry each API call once, if any of them
should fail.