在公开分支之前,我已经重新组织了分支中的提交,导致提交的时间戳顺序混乱。我宁愿他们都在今天,中间只有几秒钟。
显然这些时间戳也不正确,但由于这是事情公开的时间,所以我更喜欢它而不是混乱的历史,从时间角度来看。
那么我如何告诉 git 在变基时创建新的时间戳?
I have reorganized the commits in a branch before it is going to be made public causing the timestamps of the commits to be in an mixed up order. I would rather have them be all be today with only seconds in between.
Obviously these time stamps won't be correct either, but since this is the time when things go public I prefer that over a mixed up history, time-wise.
So how do I tell git to create new timestamps while rebasing?
发布评论
评论(4)
在我的例子中,将时间戳更改为 CommitDate 值,因此在 gitweb 中,一堆几个月前的提交显示为 4 天前。我找到了具有正确日期的最后一次提交,并执行了以下操作:
In my case rebasing changed timestamps to CommitDate value, so in gitweb a bunch of months old commits showed up as 4 days old. I found the last commit with the correct date and did:
来自评论:
实际上...它不再与 Git 2.29 (Q4 2020) 不兼容:“
git rebase -i
"(man) 了解更多选项。兼容的选项:
--interactive
/-i
--root
!请参阅 提交 6160b2e(2020 年 8 月 26 日),作者:Junio C Hamano (
gitster
)。请参阅提交 2712669(2020 年 8 月 17 日)和 提交 ef484ad(2020 年 7 月 13 日),作者:罗希特·阿希瓦尔 (
r1walz
)。请参阅提交a3894aa、提交 7573cec, 提交 e8cbe21(2020 年 8 月 17 日)作者:Phillip Wood (
phillipwood
)。(由 Junio C Hamano --
gitster
-- 合并于 提交 9c31b19,2020 年 9 月 3 日)和:
另外:
git rebase
现在包含在其git rebase
还包含在其请注意,在 2.29(上文)中,“
rebase
”和“am
”的“--committer-date-is-author-date
”选项" 子命令错误地丢失了电子邮件地址,该问题已通过 Git 2.29.1(2020 年第 4 季度)进行更正。请参阅提交 5f35edd、提交 16b0bb9, 提交56706db(2020 年 10 月 23 日)作者:Jeff King (
peff
)。(由 Junio C Hamano --
gitster
-- 合并于 提交 f34687d,2020 年 10 月 26 日)和:
From comments:
Actually... it is no longer incompatible with Git 2.29 (Q4 2020): "
git rebase -i
"(man) learns a bit more options.Options which are compatible with:
--interactive
/-i
--root
!See commit 6160b2e (26 Aug 2020) by Junio C Hamano (
gitster
).See commit 2712669 (17 Aug 2020), and commit ef484ad (13 Jul 2020) by Rohit Ashiwal (
r1walz
).See commit a3894aa, commit 7573cec, commit e8cbe21 (17 Aug 2020) by Phillip Wood (
phillipwood
).(Merged by Junio C Hamano --
gitster
-- in commit 9c31b19, 03 Sep 2020)And:
Also:
git rebase
now includes in its man page:git rebase
also includes in its man page:Note that in 2.29 (above), "
--committer-date-is-author-date
" option of "rebase
" and "am
" subcommands lost the e-mail address by mistake, which has been corrected with Git 2.29.1 (Q4 2020).See commit 5f35edd, commit 16b0bb9, commit 56706db (23 Oct 2020) by Jeff King (
peff
).(Merged by Junio C Hamano --
gitster
-- in commit f34687d, 26 Oct 2020)And:
使用 --ignore-date:
Use --ignore-date:
有以下几种方式
普通rebase
交互式变基
There are the following ways
Normal rebase
Interactive rebase