Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
131 views
in Technique[技术] by (71.8m points)

How do I view a git repo's receive history?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...