With something like git log --abbrev-commit --pretty=format:'%h %<(72,trunc)%s %d'
, you can get a fairly well aligned git commit message with a graph. It is completely aligned if you drop the --graph
option. Here is roughly what the command looks like
* 40f1481 Commit title message (HEAD, dev)
|\
| * 9b5122d Commit title message (debug)
| * fe7ddfe Commit title message
| * 8e4d414 Commit title message
| * 53affdd Commit title message
| * a45fbaf Commit title message
|/
* 36b23c3 Commit title message
* 5b7bfe1 Commit title message (master)
The issue is that with the graph symbols the alignment is messed up, as you can see in the first two commits. Here is what it should ideally look like
* 40f1481 Commit title message (HEAD, dev)
|\
| * 9b5122d Commit title message (debug)
| * fe7ddfe Commit title message
| * 8e4d414 Commit title message
| * 53affdd Commit title message
| * a45fbaf Commit title message
|/
* 36b23c3 Commit title message
* 5b7bfe1 Commit title message (master)
My question is there an option for getting the correct alignment when using the graphing option? Or to get the width of the graph so that you can pad the log accordingly?
I know a quick hack would be to just pad the first option by tab (%x09), and it should work for probably most projects, but I'm wondering if their is a aesthetically superior, foolproof option that gets by with the minimum padding but also works in cases where 5 wouldn't be enough. Here is an example where the tab solution fails
Log with using columns, without colored graph.
Complete success! Will try to update later.
%x
did and I thought when I was messing around I stumbled upon%x09
looking like 9 spaces (complete coincident I tried 9). Turned out I lucked into the tab function, and that%x05
didn't do what I thought I did. I suppose I'll do that for now.%x09
or a tab is also not a perfect option, depending on the graph some lines might be two tabs over or one. I updated the question with an image to show when it fails.