multigit: branch existence test now a function

Abstract out the code used to verify whether a branch exists in a new
function git_has_branch.

Change-Id: I08e73a5c725c0936b6dd784c15d478085204ccdb