如何根据作者的时间戳制作 git log 顺序? [英] How can I make git log order based on author's timestamp?

查看:35
本文介绍了如何根据作者的时间戳制作 git log 顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了一个相当复杂的 git-log 命令,其中涉及 --date-order 来了解我的存储库的状态;但不幸的是, --date-order 似乎使用了 committer 日期,而不是 author 日期.这意味着每次我通过将主题分支重新定位到当前上游来更新主题分支时,我都会在主题分支中的相对提交的 git-log 中失去有用的时间顺序(也就是说,每个分支都变成一条长线,因为它的所有提交都重新设置为顺序且几乎相同的提交者时间戳.)

如果我可以让 git-log 通过 author 时间戳而不是 committer 时间戳来排序提交,这将得到解决.有谁知道这样做的方法吗?

<小时>

对于那些通过 Google 结果访问此内容的人,您可能需要查看 ,输出是拓扑排序的,并且并行历史中的提交根据作者时间戳混合在一起显示."

I use a fairly complex git-log command involving --date-order to get an overview of my repository's status; but unfortunately, --date-order seems to use the committer date, not the author date. That means that each time I bring my topic branches up to date by rebasing them onto the current upstream, I lose the helpful chronological ordering in my git-log of relative commits in my topic branches (that is, each branch becomes a single long line, because all of its commits got rebased to sequential and nearly-identical committer timestamps.)

If I could get git-log to order commits by the author timestamp instead of the committer timestamp, this would be solved. Does anybody know of a way to do that?


For those visiting this from Google results, you may want to look into josephdpurcell's solution (and in-depth blog post!), below. It's quite excellent, if you're looking for standard git-log style output, multi-line, with detailed messages about each commit.

Unfortunate, I now need to amend this question, because I'm an idiot and didn't provide more specific information about my use-case: I use git-log in "--graph mode," and I need to make git-log itself operate in author-date-order. As far as I've been able to ascertain, this is completely impossible to do from outside git-log, because git-log itself handles the graph ordering and printing.

A script, or patch for git-log, may be necessary, it seems. I'll leave this open until somebody can either 1. write such a script, or 2. we can talk the git authors into including a --author --date-order combination of flags. (=


For reference, here's what my current glog function's output looks like, and what I need to re-order:

解决方案

git version 1.8.4 added an --author-date-order argument to git log; according to the release notes, "the output is topologically sorted and commits in parallel histories are shown intermixed together based on the author timestamp."

这篇关于如何根据作者的时间戳制作 git log 顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆