Guard against non-git repos

This PR gets halfway to #6. It guards against a git-update if the directory
isn't a git repo. However, it doesn't (yet) do a homebrew upgrade.

Also contains two other changes:
pushd/popd instead of relying on `cd -`
does a proper git-repo check instead of assuming a .git directory means git repo