Detect the current environment without using the upstream.

Developers should have the freedom to set other upstreams on their Git
branches.

Plus, there are other bugs e.g. issue #109 which mean that the upstream is not
set properly.
Cache environments transparently.
Use the better caching to clean up drush aliases.
Fix checkout command.