To check if a commit SHA exists on a given branch, you have a couple of options. git merge-base--is-ancestor For a low-level query about commit existence, use git merge-base with its --is-ancestor option. This command only returns the result through its exit status, so it’s most useful for …