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?
views:
36answers:
1Git’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).