'How do I check if an old commit of a deleted branch that has been merged exists in develop?

Basically, I'm trying to write a script that ensures that a certain commit has been merged.

When i try to execute the command git branch --contains 0871b8479e6332ee3bd7a1ea9ea5b53795c3b3c5 in my terminal, I face the following error:

no such commit 0871b8479e6332ee3bd7a1ea9ea5b53795c3b3c5

This commit is the hash of one of the commits of a branch that has now been merged (and the branch was subsequently deleted). I need a way to confirm that this commit has been merged into the develop branch from shell script/github cli.

PS: I've tried using other branch based approached like git branch -a --merged, but I'm still not able to confirm that either my branch or my commit have been merged.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source