On Wed, Apr 24, 2019 at 07:36:34PM +0900, Junio C Hamano wrote: > if git merge-base --is-ancestor master "$DEV_BRANCH" > then > echo "master is an ancestor of $DEV_BRANCH" > else > echo "master has commits not in $DEV_BRANCH" > git --no-pager log "master..$DEV_BRANCH" -- > fi A non-zero exit code might indicate an error in 'git merge-base' itself; I had basically the same if-else condition in a script of my own that had to check the same thing... until once I mistyped the branchname, and, well, undesired behavior ensued. After that I added one more branch to the condition like this: git merge-base --is-ancestor master "$DEV_BRANCH" ret=$? if test $ret -gt 1 then die "uh-oh, git merge-base errored out" elif test $ret -eq 0 then echo "master is an ancestor of $DEV_BRANCH" else echo "master has commits not in $DEV_BRANCH" fi