本文介绍了Git:父提交比后代年轻?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在浏览 http://arago-project.org/git/projects/linux-omap3.git 仓库,并遇到了一个奇怪的日期问题,该事件基本上表明父提交比其孩子年轻一岁.
I was browsing http://arago-project.org/git/projects/linux-omap3.git repo and came across a strange date-thing, which basically says that parent commit is a year younger than its child.
这怎么可能?
user@ubuntu1004:/f/linux-omap3$ git log -2 --parents 4b8db3b
commit 4b8db3b368f5601717e3ffee0051628ba33172d3 3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5
Author: Kevin Hilman <[email protected]>
Date: Fri Aug 20 11:19:52 2010 -0700
OMAP: bus-level PM: enable use of runtime PM API for suspend/resume
[...skipped...]
Cc: Rajendra Nayak <[email protected]>
Signed-off-by: Kevin Hilman <[email protected]>
commit 3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 65f42886e24be2197b1263f138eabf40c6774d00
Author: Linus Torvalds <[email protected]>
Date: Tue Jan 4 16:50:19 2011 -0800
Linux 2.6.37
推荐答案
如注释中所述:
- 您将所需的任何时间戳记都提交了:" git commit-setting未来的时间戳记"
- 您可以修改提交的时间戳:""
- 您要处理两个日期:
GIT_AUTHOR_DATE
和GIT_COMMITER_DATE
:请参见.
- you put any timestamp you want on a commit: "git commit - setting timestamps into the future"
- you can amend the timestamp of a commit: "How can one change the timestamp of an old commit in Git?"
- You are dealing with two dates:
GIT_AUTHOR_DATE
andGIT_COMMITER_DATE
: See working with date in Git.
您看到的可能是以下情况的结果:
What you see could be the result of a:
- rebase,因为默认情况下
git rebase
实际上不会更改作者的时间戳:请参阅"". - 樱桃采摘(如),因为它还保留了
GIT_AUTHOR_DATE
- rebase, since
git rebase
does actually not change authors' timestamps by default: see "git rebase without changing commit timestamps". - cherry-picking (as commented by Michael Anderson) since it also preserves
GIT_AUTHOR_DATE
这篇关于Git:父提交比后代年轻?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!