Do not crash when a repo has a detached HEAD

Instead, we select a default branch - master by default, but the default
branch can be configured using config.ini.

Note that if the default branch does not exist in a repo, that should
not cause any issues.

Also adds phpunit to composer.json's require-dev section.
Revert changes to composer.json and composer.lock

Note that this commit depends on a pull request for gitter, and is
therefore in an untestable state after reverting composer.json.
Its predecessor should be testable, however.
Merge pull request #263 from NateEag/handle-no-active-branch

Do not crash when a repo has a detached HEAD