There are various ways to "select" commits with git log. For example:
- How to list all commits that changed a specific file?
- How can I view a git log of just one user's commits?
and many others.
However, all of these show only the commits selected for on the command line. What I want is to see all the commits in my range, but highlight (with color, or a marker, or whatever) a specific subset of these commits e.g. the commits that changed a particular file or whatever. So when doing:
git log --oneline master..@ -- path/to/frobnitz
instead of seeing:
12ca6d863 foo
6166da1fd bar
894567343 baz
I would see something like:
46984ad11 (HEAD -> master) git is fun!
2e11a5382 cool beans
>> 12ca6d863 foo
60069036d whatever
d698663d0 something
>> 6166da1fd bar
3d2c811e3 more cool stuff
>> 894567343 baz
3d2c811e3 cool stuff
Furthermore, the ideal solution would work with --graph
mode, because I also want to see the merge and branch contexts of the selected commits.
I also note that git log
supports various History Simplification scenarios, which get me almost what I want in some cases, but its not easy to figure out how, nor is it exactly what I want. I already have the history I want to see, and I already have the commits I want to highlight.
Some ideas I had, but I don't like any of them:
Script it -- run two git logs and then use the output of one to decorate/manipulate the other. The downside of this is that its brittle and it won't work well for different sets of options I might supply to the target log e.g.
--graph
For the "selected" commits, assign temporary refs e.g.
selectedcommits
to them, and then use--decorate-refs=selectedcommits
to show the relevant commits. This seems messy.