Given a large git repository with hundreds of branches / thousands of commits, and an irregular branch merging strategy, how does one determine the shortest path between two commits? In other words, What path of branches from earlier commit A to later commit B crosses the least number of commits?
(In my case I'm trying to trace the history of a 'develop' branch that had inadvertently been merged into feature branches via fast-forward. A "shortest path" strategy seemed like a practical approach, but I've been looking through the help pages for git-log and git-rev-list [v1.8.3.1], but haven't found any option that seems to do this. Am I missing something obvious?)
I'm not sure what you're asking, but to find how A got to B you can use this:
You can use the
--graphand--simplify-mergesflags to make it more clear.You can also prettify the log like so:
and get output like this: