How to display all Git branch heads AND commits that affect a specific file in a single graph

342 Views Asked by At

I would like to get a similar view to gitk --all -- <path> that also includes all branch heads. By default, gitk invoked like that selects all commits that affect the given path and displays a simplified graph that includes only those commits. If some of those commits happen to be branch heads or to correspond to tags, the branches or tags are drawn as well. That is basically half of what I want. In addition to the commits that affect the given path, I would like the graph to also include all the commits that correspond to branch heads.

This kind of graphic representation would tell me which of the commits that affect the given path are accessible/included on each branch.

One possible way of doing this would be to get a list of all commits that affect the given path (for example using git rev-list) and the list of all commits that are referenced by branch heads and pass the combined list to gitk to get a graphical representation. But gitk doesn't seem to support being passed a list of specific commits to include.

1

There are 1 best solutions below

3
jthill On BEST ANSWER

Add --simplify-by-decoration, and use git log to specify which exact decorations you want, e.g.

git log --graph --decorate-refs=refs/heads/* --oneline --branches \
        -m --name-status --simplify-by-decoration -- path/to/file.1 e/t/cetera