Two branches diverged a long time ago (e.g. devel and master). I'd like to show the history either side of that divergence point, e.g. +/-10 commits. (This is to decide how to recapture the old branches give a change in naming convention)
It is easy to locate the merge-base (git merge-base devel master
), and to show the 10 commits before that (e.g. git log --oneline -10 $(git merge-base devel master)
).
But I'm not sure how to locate the points 10 commits before (more recent than) the merge-base to limit the commit range displayed (e.g. with show-branch).
Is there a way to the n'th more recent commit along a given line of development?
For this you just want grep's context option.
If you want the graph structure drawn for those, git log has to print some lines without commits to keep everything connected properly and that will mess with your counts. So get the raw commit ids first and then tell log to graph them all explicitly: