Log an error if we can't find the branch

Don't use --exit-code, which isn't there in older versions of git