Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: Is there a command line option for "Sort by date" for gitk?

I'm trying to find a command line option for gitk that has the same effect of "Strictly sort by date" in the "View / Edit view..." window.

man gitk shows a very limited number of options compared to those available in the GUI.

like image 574
digitalsky Avatar asked Nov 18 '11 19:11

digitalsky


1 Answers

The man gitk at least mentions it does take the same options than git rev-list, including

--date-order 

This option is similar to --topo-order in the sense that no parent comes before all of its children, but otherwise things are still ordered in the commit timestamp order.

See "Guide to understanding gitk?" for more.


Note: if -d or --date-order is really the argument you are after, better not using too much, according to Linus himself (from lists-archives.com/git or www.spinics.net/lists/git/):

The thing is, --date-order strings out and mixes up the commits on the same development chain, and by doing so it makes the different chains of development much harder to see.
It also ends up showing the development in a more "parallel" way, which in turn makes the view even harder to read.

So I would suggest not using --date-order by default. It doesn't add anything to any normal flow, and it makes the big picture harder to see.

The only time you really want --date-order (or "-d", which is shorthand for it for just gitk) is really

  • when the big picture is really really simple, and you actually want to see more detail because the big picture is too trivial to even be interesting otherwise.
    (In other words: --date-order is fine for really simple development where there is only ever just a couple of branches or where you have pruned away so much of the history that the remaining part is simple)
  • when you want to debug "git rev-list" behaviour itself, since the date order actually matters for how git traverses the commit chains.

The second case is something that I suspect nobody but me and a few other people have ever done.
I found it very useful together with --show-all when I was debugging the revision walker (see commits "Add "--show-all" revision walker flag for debugging" and "Make revision limiting more robust against occasional bad commit dates ", where the first implements --show-all, and the second one is the end result of my debugging).

In other words: never start out with "-d" or "--date-order" by default.
Only if you have some reason to then think that the view is too simple or you need to drill down into the commit relationships should you use it.

like image 198
VonC Avatar answered Oct 18 '22 07:10

VonC