本文介绍了为什么在git中提交日期乱序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我做'git log'时,为什么提交的日期是乱序?

When I do a 'git log', why is the date of the commits out of order?

我正在查看我的存储库的1个分支。日期应该是正确的,对吗?

I am looking at 1 branch of my repository. the date should be in order, right?

推荐答案

不能保证日期应该是任何顺序。事实上,你可以很容易地使用Git伪造日期。

There's no guarantee that the dates should be in any order. In fact, you can easily forge dates with Git.

尽管这很可能是由于或采摘樱桃。例如,我经常做的是在本地提交一些工作,然后 git pull --rebase 。结果是历史被重写,以便我的提交现在是在 origin / master 中同时引入的提交的子元素,但是 git rebase 不会更改进程中的提交日期。 git cherry-pick 具有相同的效果。

Most likely, though, this is due to rebasing or cherry-picking. E.g., what I often do is commit some work locally, then git pull --rebase. The result is that history is rewritten so that my commits are now children of the commits that were introduced in origin/master in the meantime, but git rebase does not change the date of the commits in the process. git cherry-pick has the same effect.

如果您想查看提交更改的日期,您可以执行 git log --pretty = fuller 以查看 CommitDates 以及 AuthorDates 。这些更可能是为了,但即使在这里,也没有保证。

If you want to see the dates at which changes were commited, you can do git log --pretty=fuller to see the CommitDates as well as the AuthorDates. These are more likely to be in order, but even here, there's no guarantee.

这篇关于为什么在git中提交日期乱序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 05:01