does branch exists
# Remote:
# Ref: https://stackoverflow.com/questions/8223906/how-to-check-if-remote-branch-exists-on-a-given-remote-repository
# test if the branch is in the remote repository.
# return 1 if its remote branch exists, or 0 if not.
function is_in_remote() {
local branch=${1}
local existed_in_remote=$(git ls-remote --heads origin ${branch})
if [[ -z ${existed_in_remote} ]]; then
echo 0
else
echo 1
fi
}