How can I tell if one commit is a descendant of another commit?

From Git 1.8.0, this is supported as an option to merge-base:

git merge-base --is-ancestor <maybe-ancestor-commit> <descendant-commit>

From the man page:

–is-ancestor

Check if the first is an ancestor of the second ,
and exit with status 0 if true, or with status 1 if not. Errors are
signaled by a non-zero status that is not 1.

For example:

git merge-base --is-ancestor origin/master master; echo $?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)