Is it possible to collapse fully-merged branches when using git log --graph
?
Instead of having git log --graph --branches
displaying:
* 16bb2c5 (HEAD, dev) Merge branch f
|\
| * 4571fbd Commit 14
| * de845ac Commit 13
|/
| * aba23a5 (branch e) Commit 12
|/
* 305d031 Merge branch c
|\
| | * 80c47c6 (branch d) Commit 11
| | * dbc182e Commit 10
| | * 18bb013 Commit 9
| |/
| * 879e64a Commit 8
| * b9a1413 Commit 7
| * ddd92f9 Commit 6
|/
* 2e94cc8 Merge branch b
|\
| * 852ddaf Commit 5
| * 88cdaf9 Commit 4
| * d1d7c7b Commit 3
|/
| * bd1557a (branch a) Commit 2
|/
o e740474 (master) Commit 1
Since branches a
and c
have been fully merged (and removed so --branches
doesn't try to show them), I would like to have (with or without the # COLLAPSED
comments):
* 16bb2c5 (HEAD, dev) Merge branch f ### COLLAPSED
| * aba23a5 (branch e) Commit 12
|/
* 305d031 Merge branch c
|\
| | * 80c47c6 (branch d) Commit 11
| | * dbc182e Commit 10
| | * 18bb013 Commit 9
| |/
| * 879e64a Commit 8 ### DO NOT COLLAPSE THOSE COMMITS SINCE BRANCH D ISN'T MERGED
| * b9a1413 Commit 7
| * ddd92f9 Commit 6
|/
* 2e94cc8 Merge branch b ### COLLAPSED
| * bd1557a (branch a) Commit 2
|/
o e740474 (master) Commit 1
My use case is the following. I would like to have an alias to display all local commits that I didn't merged yet, from the list of local branches, starting from master, unless they are not a descendant of the first parent (recursively) of dev. EDIT: The goal is to differentiate between what is integrated and what is still research-in-progress work.
Note that git log --graph --branches --first-parent
display all the commits I want, but doesn't include the links between all the visible parents of all commits (879e64a Commit 8
isn't linked as the second parent of 305d031 Merge branch c
).
* 16bb2c5 (HEAD, dev) Merge branch f
| * aba23a5 (branch e) Commit 12
|/
* 305d031 Merge branch c ### MISSING LINK WITH 879e64a Commit 8
| * 80c47c6 (branch d) Commit 11
| * dbc182e Commit 10
| * 18bb013 Commit 9
| * 879e64a Commit 8 ### MISSING LINK WITH 305d031 Merge branch c
| * b9a1413 Commit 7
| * ddd92f9 Commit 6
|/
* 2e94cc8 Merge branch b
| * bd1557a (branch a) Commit 2
|/
o e740474 (master) Commit 1