Tidy up around tags/branches code

 - If a tags was not found during the lookup because only local branches are
shown then a crash would occur as index would be -1.

 - Actually add the tags to the tag list of a commit when the function is
called instead of ignoring it.

 - Remove some included head files that are not required.
Clean up the repo before creating another one.