Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 587
Mark Achée Avatar asked Oct 06 '10 19:10

Mark Achée


People also ask

How do I see my git repository history?

Git file History provides information about the commit history associated with a file. To use it: Go to your project's Repository > Files. In the upper right corner, select History.

What is the git history log?

What does git log do? The git log command displays all of the commits in a repository's history. By default, the command displays each commit's: Secure Hash Algorithm (SHA)

How do I see git repository contents?

The Git Show command allows us to view files as they existed in a previous state. The version can be a commit ID, tag, or even a branch name. The file must be the path to a file. For example, the following would output a contents of a file named internal/example/module.go file from a tagged commit called “release-23”.


1 Answers

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

like image 150
Chris Johnsen Avatar answered Oct 13 '22 05:10

Chris Johnsen