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?
g
q
, q master, (, gitk --merges Find), Git .
master
gitk --merges
Find
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
, Git , :
q - git log.
git log
git log --oneline --graph
less ( , less ), /, sha g, less git log . , q.
less
/
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.
--merges
--ancestry-path