git merge-base --is-ancestor master HEAD
A common idiom to check "fast-forward-ness" between two commits A and B is (or at least used to be) to compute the merge base between A and B, and check if it is the same as A, in which case, A is an ancestor of B. You will see this idiom used often in older scripts.
A=$(git rev-parse --verify A)
if test "$A" = "$(git merge-base A B)"
then
... A is an ancestor of B ...
fi
In modern git, you can say this in a more direct way:
if git merge-base --is-ancestor A B
then
... A is an ancestor of B ...
fi
instead.
Just brilliant! And google friendly. Appreciative.