Fixing re-declaration and wrong comparison

Also displaying more feedback when a wrong branch or
hash was provided.