Git contains between arbitrary commits
I was wondering if there is a generic method for determining if a commit is the parent of another.
git branch --contains <hash>
I almost want to. It lists all the branches containing a commit, but I want to know if an arbitrary commit "contains" another commit.
My temporary hack is to create a branch in a commit and then check if it is in the list, but that seems sloppy.
git branch __temp_branch__ <hash1>
git branch --contains <hash2> # check if __temp_branch__ is in output
git branch -d __temp_branch__
+3
source to share
3 answers