Let\'s say I have the following local repository with a commit tree like this:
master --> a
\\
\\
develop c --> d
I have a solution to your overall problem (determine if feature
is descended from the tip of develop
), but it doesn't work using the method you outlined.
You can use git branch --contains
to list all the branches descended from the tip of develop
, then use grep
to make sure feature
is among them.
git branch --contains develop | grep "^ *feature$"
If it is among them, it will print " feature"
to standard output and have a return code of 0. Otherwise, it will print nothing and have a return code of 1.