如何从push
中的特定遥控器获取所有git
命令的列表?
对于我的情况,可以在远程或本地存储库上运行。
对于奖励积分,我如何获得所有成功 push
命令的列表?
答案 0 :(得分:17)
此方法只会为您提供成功的推送,但它可能仍然对您有用:
当您推送到与您的某个远程跟踪分支对应的远程分支中,并且该推送成功时,将更新远程跟踪分支。在您从存储库克隆的默认情况下,这通常意味着成功推送到远程master
中的origin
将更新远程跟踪分支origin/master
。对origin/master
的更改记录在reflog中,因此您可以通过以下方式找到成功推送:
git reflog show origin/master
例如,在我的一个存储库中,您将看到:
17f2303 refs/remotes/origin/master@{0}: fetch origin: fast-forward
dd7e0ac refs/remotes/origin/master@{1}: fetch origin: fast-forward
1788ffe refs/remotes/origin/master@{2}: fetch origin: fast-forward
9763bbc refs/remotes/origin/master@{3}: fetch origin: fast-forward
058d0d6 refs/remotes/origin/master@{4}: fetch origin: fast-forward
921f0f1 refs/remotes/origin/master@{5}: fetch origin: fast-forward
8483afd refs/remotes/origin/master@{6}: update by push
18d527f refs/remotes/origin/master@{7}: update by push
1a0fc4a refs/remotes/origin/master@{8}: fetch origin: fast-forward
b19afc6 refs/remotes/origin/master@{9}: fetch origin: fast-forward
9253285 refs/remotes/origin/master@{10}: fetch origin: fast-forward
dfa664f refs/remotes/origin/master@{11}: fetch origin: fast-forward
30ee7c0 refs/remotes/origin/master@{12}: update by push
ad11e76 refs/remotes/origin/master@{13}: fetch origin: fast-forward
c337975 refs/remotes/origin/master@{14}: update by push
1ff03bd refs/remotes/origin/master@{15}: update by push
7fb1c8d refs/remotes/origin/master@{16}: fetch origin: fast-forward
452c8fa refs/remotes/origin/master@{17}: fetch origin: fast-forward
6c79a16 refs/remotes/origin/master@{18}: update by push
11d9c4a refs/remotes/origin/master@{19}: fetch origin: fast-forward
例如,您可以从中了解到,我最近的推送已将origin/master
从18d527f
更新为8483afd
。
如果你需要依赖这个,你需要在默认时间(第二天90天)之后停止reflog过期。
答案 1 :(得分:4)
用于Windows的Tortoise-Git具有" Show RefLog"选项https://tortoisegit.org/docs/tortoisegit/tgit-dug-update.html,包括提交日期。