更新时间:2022-12-12 13:10:20
您的问题有点不确定,因为git log
始终对输出进行排序,但
Your question is a bit underspecified, because git log
always sorts its output, but it takes options telling it how to sort:
提交订购
默认情况下,提交将按相反的时间顺序显示.
By default, the commits are shown in reverse chronological order.
--date-order
--author-date-order
--topo-order
因此,没有任何选项,git log
会按时间顺序显示提交,无论如何.
Hence, with no options, git log
shows commits in chronological order no matter what.
我思考,您要问的是,您如何更改重新设置的提交上的时间戳.默认情况下,rebase会保留时间戳.
I think what you're asking is, instead, how you can change the time stamps on the rebased commits. By default, rebase preserves the time stamps.
请注意,每次提交有两个 时间戳:作者日期和提交者日期.
Note that there are two time stamps on each commit: the author date, and the committer date.
rebase文档描述了这两个选项:
--committer-date-is-author-date
,--ignore-date
git am
,以轻松更改重新基于基础的提交的日期(请参见git-am(1)).与--interactive
选项不兼容.
git am
to easily change the dates of the rebased commits (see git-am(1)). Incompatible with the --interactive
option.咨询 git am
文档对此有更好的描述:
Consulting the git am
documentation gives a better description of these:
--committer-date-is-author-date
--ignore-date
您可以使用带有git log
的fuller
格式(例如(git log --format=fuller
))查看作者和提交者的日期.
You can see both author and committer dates using the fuller
format with git log
, for instance (git log --format=fuller
).
我相信您想使用--ignore-date
,这将使每个基于重新提交的提交从现在开始"进行(假定我正确地解释了您的问题!).
I believe you want to use --ignore-date
, which makes each rebased commit happen "as of right now" (this assumes I'm interpreting your question correctly!).