如何查看我 git 提取的最后三个时间戳?

how to see the last three time stamps that I did git pull?

我发现只有一种方法可以看到最后一个 git pull,这是我已经完成的最新一个,我想知道我在最近完成的那个之前做了那个。因为我想在我拉取它的日期将我的回购协议反转为该特定版本,而我最近一次拉取它时搞砸了。 所以总而言之,我需要的 BEFORE my latest git pull 的时间戳。

repo 是基于 bitbucket 的 git repo。

有没有办法做到这一点?

How do I check the date and time of the latest `git pull` that was executed?

这个答案有不同的方法来查找上次编辑文件的时间。

由于您使用了 osx 标签,这将使您能够看到上次 运行 git pull:

stat -f '%m' .git/FETCH_HEAD

应该打印出最后一次编辑 FETCH_HEAD 的时间戳,这是你最后一次 运行 git pullgit fetch.

遗憾的是,我认为不可能按照您的要求进行操作。您可以使用 stat 找到上次访问、上次更改、上次修改 和文件的创建时间,但我认为找不到 [=30] 的历史记录=] 是可能的。

git reflog --date=iso

输出:

2b88250 HEAD@{2016-12-02 01:22:55 +0200}: pull ssh://localhost:29418/test-project refs/changes/07/7/1: Fast-forward
b49719d HEAD@{2016-12-02 01:20:46 +0200}: pull ssh://localhost:29418/test-project refs/changes/06/6/1: Fast-forward
1f384f6 HEAD@{2016-12-02 01:19:06 +0200}: clone: from ssh://localhost:29418/test-project

对于您当前的 b运行ch,您可以通过执行以下操作来获取您 运行 的所有 git pull 命令的日期:

$ for i in $(cat .git/logs/refs/heads/<YOUR_BRANCH_NAME_HERE> | grep pull | awk '{print }');do date -d@$i; done

注意: awk 参数可能会根据 git 版本而改变。此 awk arg 适用于 git 版本 1.8.3.1