如何检索Git Pull历史记录

21
每当我从远程仓库拉取代码到本地仓库时,Git是否会存储我拉取的时间?我能否查看我在本地仓库中所做的拉取记录日志?

1
reflog - phd
1个回答

32

您可以尝试查看git reflog的内容... 但这将受时间限制(默认为90天)

vonc@VONCAVN7 D:\git\git
> git reflog --date=iso|grep pull
3ec7d702a HEAD@{2017-09-10 17:42:57 +0200}: pull --no-commit origin master: Fast-forward
b3622a4ee HEAD@{2017-08-12 10:36:08 +0200}: pull: Fast-forward
97e2ff464 HEAD@{2017-06-17 18:43:28 +0200}: pull: Fast-forward
8d1b10321 HEAD@{2017-06-08 20:36:08 +0200}: pull: Fast-forward
10c78a162 HEAD@{2017-05-21 21:22:58 +0200}: pull: Fast-forward
b06d36431 HEAD@{2017-05-14 07:36:49 +0200}: pull: checkout b06d3643105c8758ed019125a4399cb7efdcce2c
1d1bdafd6 HEAD@{2016-12-22 00:36:52 +0100}: pull --no-commit origin master: checkout 1d1bdafd64266e5ee3bd46c6965228f32e4022ea
3ab228137 HEAD@{2016-11-12 08:25:02 +0100}: pull: checkout 3ab228137f980ff72dbdf5064a877d07bec76df9
2632c897f HEAD@{2016-08-20 21:52:51 +0200}: pull: checkout 2632c897f74b1cc9b5533f467da459b9ec725538
2376d3178 HEAD@{2016-08-13 09:19:54 +0200}: pull: checkout 2376d31787760af598db23bb3982a57419854e5c
f8f7adce9 HEAD@{2016-07-31 13:34:44 +0200}: pull: checkout f8f7adce9fc50a11a764d57815602dcb818d1816
ab7797dbe HEAD@{2016-06-22 11:53:20 +0200}: pull: checkout ab7797dbe95fff38d9265869ea367020046db118

1
感谢@VonC。reflog似乎是从.git / log中的HEAD日志中填充的。由于我注意到时间与提交时间不同,因此我认为这是我一直在寻找的拉取时间。 - jason
2
这真的很有帮助,让我知道我们从远程仓库pull代码的时间。好问题,好回答。 - AbuTaareq
2
对于Windows用户:请使用findstr代替grep - Venryx
3
@Venryx 我通常会将 Git for Windows 的 usr/bin 文件夹添加到 %PATH% 变量中(例如 https://stackoverflow.com/a/38672939/6309):这意味着我可以使用 200 多个 Linux 命令,包括 grep.exe - VonC

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接