The main gitshed functionality.

Pulls together code from previous commits.

The main() wrapper, BUILD files etc. will follow shortly.
If the move succeeds then relpath is definitely nonexistent, since that was the source of the move.