我该如何获取特定远程git
存储库中所有push
命令的列表?
对于我的情况,在远程或本地存储库上运行都可以。
如果要额外加分,如何获取所有push
命令的成功列表?
我该如何获取特定远程git
存储库中所有push
命令的列表?
对于我的情况,在远程或本地存储库上运行都可以。
如果要额外加分,如何获取所有push
命令的成功列表?
这种方法只会给你成功的推送记录,但仍然可能对你有用:
当你向与你的远程跟踪分支相对应的远程分支推送,并且推送成功时,远程跟踪分支将被更新。在默认情况下,如果你是从一个仓库克隆的,这通常意味着对于远程 origin
中 master
的成功推送将更新远程跟踪分支 origin/master
。对 origin/master
的更改会记录在引用日志中,因此你可以使用以下命令找到成功的推送记录:
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
。
gc --auto
;它将过期早于默认90天的reflogs。如果您希望保持这种状态,请将gc.reflogExpire
设置为“never”(或更大的值)。 - Cascabelgit config --global gc.reflogExpire never
。 - Craig S. Anderson