【问题标题】:how to see the last three time stamps that I did git pull?如何查看我执行 git pull 的最后三个时间戳?
【发布时间】:2017-04-16 14:23:44
【问题描述】:

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

repo 是基于 bitbucket 的 git repo。

有没有办法做到这一点?

【问题讨论】:

    标签: git macos github command-line bitbucket


    【解决方案1】:

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

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

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

    【讨论】:

      【解决方案2】:

      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
      

      【讨论】:

      • ohhhhhhh maaanannnnnnnn
      【解决方案3】:

      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 找到上次访问、上次更改、上次修改和文件的创建时间,但我认为查找“上次修改”的历史是不可能的。

      【讨论】:

        猜你喜欢
        • 2016-11-03
        • 2023-03-12
        • 2011-02-28
        • 1970-01-01
        • 1970-01-01
        • 2012-07-02
        • 2019-01-05
        • 2017-01-02
        • 2016-04-26
        相关资源
        最近更新 更多