我如何查看git repo的接收历史记录? [英] How do I view a git repo's receive history?

查看:416
本文介绍了我如何查看git repo的接收历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个中央回购,用于部署到我们的开发服务器。我知道 git log 会显示提交以及它们提交的日期/时间,但是我希望看到提交何时被提交到/接收到回购。任何方式做到这一点?

解决方案

Git's reflogs 会记录您指定的数据(日期和新提示提交)。



,那么它的reflog可能没有被启用(当创建一个裸仓库时,它们没有默认启用)。像这样启用它们:

  git config core.logAllRefUpdates true 

您还应该考虑查看与reflog相关的其他配置选项(请参阅并搜索reflog): >

您可能还希望启用 receive.denyDeletes (因为删除分支时会删除reflog)。如果您只关心保留某些分支上的reflog,那么您可以使用接收或更新钩子来实现您自己的预分支拒绝删除(请参阅​​)。

一旦启用了推荐日志,您可以使用

git reflog显示分行名称

git log -g branch-name (可以与其他的 log
选项结合使用)。



这仍然不包含您可能需要的其他信息(例如,谁在推送新提示 * ),但可能有所帮助。

*
问题是,身份验证系统(SSH,SSH + gitolite,HTTP,HTTP + git-http-backend 等)通常不会通过这个信息直至记录新的reflog条目的级别;我记得一些组织(Gentoo?)正在探索一些有助于记录这些信息的东西(因为他们正在考虑迁移到Git),但我不记得这些细节)。


We have a "central" repo that we use to deploy to our development server. I know git log will show me commits and the date/time they were committed, but I'd like to see when commits were pushed to/received by the repo. Any way to do this?

解决方案

Git’s reflogs will record your specified data (date, and new tip commit).

If your central repository is bare, then its reflogs are probably not enabled (they are not enabled by default when creating a bare repository). Enable them like this:

git config core.logAllRefUpdates true

You should also consider reviewing the other configuration options related to the reflogs (see git-config(1) and search for "reflog"): gc.reflogexpire, gc.reflogexpireunreachable.

You may also want to enable receive.denyDeletes (since a reflog is deleted when its branch is deleted). If you are only concerned with preserving the reflogs on certain branches then you could implement your own pre-branch "deny delete" with a receive or update hook (see githooks(5)).

Once you have enabled the reflogs you can review their contents with either
git reflog show branch-name or
git log -g branch-name (either may be combined with other git log options).

This will still not include other information that you may want (like who was pushing the new tip*), but it might help.
* The problem is that the authentication system (SSH, SSH+gitolite, HTTP, HTTP+git-http-backend, etc.) does not usually pass this information down to the level that records the new reflog entry; I recall that some organization (Gentoo?) was exploring something that would help record this information (as they are/were considering migrating to Git), but I do not recall the details).

这篇关于我如何查看git repo的接收历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆