Patryk
Patryk

Reputation: 24092

How to get git log --oneline --graph with chronological commits/merges between branches?

For now I have the following alias (found somewhere on the internet):

[alias]
  lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all

but this will produce something like that in my repo:

* a18c363 - (2 weeks ago) Fix | Changed sed separator - Patryk (wierd_branch)
* 7c6ddd8 - (2 weeks ago) Feature  - Patryk 
* 2bd909b - (2 weeks ago) Fix | This was not supposed to be there.... - Patryk 
* a99f925 - (2 weeks ago) Feature | Added  - Patryk 
| * ed2da1d - (45 minutes ago) Feature | Added - S (origin/master, origin/HEAD)
| * d580796 - (2 hours ago) Fix | Tag - W 
| * e0b1611 - (2 hours ago) Fix - S
| * 8588818 - (2 weeks ago) Documentation | Incremented documentation version - X
|/  
* 05ff79b - (2 weeks ago) Fix | changed structure - M

But as you can see this is not chronological - namely, the branches give straight lines instead of showing that the commits in e.g. 2 branches have happened chronologically (e.g. ed2da1d should be on the top of the log).

How can I make that chronological? (for instance GitLab has some kind of this log that show chronological commits in multiple branches but in its web UI)

Upvotes: 0

Views: 710

Answers (1)

jthill
jthill

Reputation: 60255

Going on the behavior it looks like giving an explicit date format lights --topo-order. That's weird, but explicitly giving --date-order fixes it for me.

Upvotes: 1

Related Questions