The main gitshed functionality.

Pulls together code from previous commits.

The main() wrapper, BUILD files etc. will follow shortly.
I usually try to avoid break and continue (and early returns). They make code harder to reason about. They have their place, but I don't think this is one of them. 

Again, I'm philosophically opposed to attempting to code defensively against indentation errors. Python is what it is...