'Sudden color change in "git log"

Please consider the following git log alias I use:

log --date-order --color-moved --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''%C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all

And now, please consider the following screenshot the above alias produces: enter image description here As one can see, in the red circles in the screenshot, there are sudden color changes. Why is that?

I think its an issue with my alias.

EDIT: Clarification as requested by @eis in the comments: for example, take a look at the first red circle. There is a new branch starting there, right? It starts with yellow / and then immediately change to a blue |. It should have started with blue.



Solution 1:[1]

Clarification as requested by @eis in the comments: for example, take a look at the first red circle. There is a new branch starting there, right?

No, there isn't. The text at this area reads:

| * 8760adec - Wed, 23 Mar 2022 22:47:50 -0200 (5 weeks ago)
|/            Red - refaelsh
| * 6a8d1d15 -  Wed, 23 Mar 2022 22:28:12 -0200 (5 weeks ago)

The yellow forward slash on the middle line connects from the * marking commit 8760adec to the left-hand-side vertical lines | leading down to commit * 8ddae51a, indicating that the (single) parent of 8760adec is 8ddae51a.

The start of the branch is way down off the bottom of the screen and is probably the root commit. The end of the branch is off the top of the screen. A branch name selects whichever commit is to be considered "the last commit of that branch".1

It's true that parent commit 8ddae51a is on both branches, i.e., the one that's being traced down the left edge and also the one for which the yellow slash connects downwards to the left edge. Child commit 8760adec is only visibly on one branch (although it may be on many others as well; we just aren't viewing them if that's the case).

In any case, the point of the colorization of the |, /, \, etc., characters is just to let you follow them a little better with your eyes. They do not mark specific branches. That's impossible, since many commits are on many branches at the same time.


1The first commit is usually the root commit, which is usually on every branch. Some people like to swap the meanings of first and last here, since Git works backwards: the tip commit, as named by the branch, is the "last" commit but it's always the first you see when you have Git look at commits, since Git works backwards.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 torek