Find merge commit for release branch

With the following git story:

            f---g---h--- feature
           /         \
      c---e---i---j---k---l--- release
     /                     \
-a--b---d---m---n---o---p---q---[hundreds of commits]--- master

I have a SHA commit g. Neither function nor release is available anymore, and I need to find commit q, IE, where the release branch has been merged with the wizard. With the answers in another question ( Find a command commit that includes a specific commit ) I can only find commit k, where the function branch has been merged into release branches. How should I do it?

+4
source share
3 answers

, q master, (, gitk --merges Find), Git .

master, g, script, :

g=ad198bc
for i in $(git log --merges --reverse --format=%H); do
    revlist=$(git rev-list -1 $g --not $i)
    if [ $? -eq 0 ]; then
        if [ "$revlist" = "" ]; then
            echo "Merge commit $i has $g merged."
            exit
        fi
    fi
done
+2

, Git , :

            f---g---h--- feature
           /         \
      c---e---i---j---k---l--- release
     /                     \
-a--b---d---m---n---o---p---q---[hundreds of commits]--- master

q - git log.

git log --oneline --graph

less ( , less ), /, sha g, less git log . , q.

0

I would suggest the following:

git log --merges --ancestry-path g..q

--mergesonly merge transactions are recorded, and --ancestry-pathrestricts the commit only to those that are on the path between g and q. In this case, he should show you both k and q.

-one
source

All Articles