加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – git:gitk有“按日期排序”的命令行选项吗?

发布时间:2020-12-14 02:20:31 所属栏目:Linux 来源:网络整理
导读:我正在尝试为gitk找到一个命令行选项,该选项与“View / Edit view …”窗口中的“按日期严格排序”具有相同的效果. 与GUI中提供的选项相比,man gitk显示的选项数量非常有限. 解决方法 man gitk 至少提到它确实采取与 git rev-list 相同的选项,包括 --date-or
我正在尝试为gitk找到一个命令行选项,该选项与“View / Edit view …”窗口中的“按日期严格排序”具有相同的效果.

与GUI中提供的选项相比,man gitk显示的选项数量非常有限.

解决方法

man gitk至少提到它确实采取与 git rev-list相同的选项,包括
--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.

有关更多信息,请参见“Guide to understanding gitk?”.

注意:如果-d或–date-order确实是你所追求的参数,最好不要使用太多,根据Linus本人(从lists-archives.com/git或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 “07005” and “07006”,
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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读