Augment/rewrite the git utilities to enable replacing the git jenkins plugin.

We'd like to remove use of the git jenkins plugin to give us more
control over how we manage our git repos on jenkins.  In particular,
this is a necessary step to moving towards shared object dirs (so
every workspace would use the same webapp objects rather than having
to have their own copy).  This will be faster and use less disk.

The main change is adding a routine to clone/fetch a repo.  This is
the main thing the git jenkins plugin does for us.  I also added
timeouts, to match the plugin as well.

Finally, I did a pass through based on my increased (though still not
great) knowledge of git, and cleaned up some existing commands.  There
are things I could probably simplify even more, such as using 'git
checkout -f' rather than 'git reset --hard && git checkout'.

I separated out 'pull' into fetch + rebase, to make it easier to move
to a shared-objects scheme later.

Auditors: chris

Test Plan:
I ran the following script on my local machine, without error:
```
$ cd /tmp
$ . ~/khan/jenkins-tools/build.lib
$ safe_sync_to git@github.com:Khan/beep-boop master no_submodules
$ ls beep-boop/alertlib/
<no files>
$ safe_sync_to git@github.com:Khan/beep-boop master
$ ls beep-boop/alertlib/
LICENSE  README.md  alert.py  alertlib  tests  timeout.py
$ safe_sync_to git@github.com:Khan/beep-boop c6a1dd138fa51
$ cd beep-boop
$ git status
HEAD detached at c6a1dd1
$ safe_pull
$ git status
On branch master
$ safe_push
$ safe_push
Current branch master is up to date.
Everything up-to-date
$ safe_commit_and_push .
No changes, skipping commit
Current branch master is up to date.
Everything up-to-date
```