Why is the date of commits in git log out of order?

前端 未结 2 1062
[愿得一人]
[愿得一人] 2021-02-07 12:38

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

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

2条回答
  •  醉话见心
    2021-02-07 12:49

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

    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.

    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.

提交回复
热议问题