Check who pushed a Git commit
Asked Answered
E

3

18

short: Is there any way to view who has pushed a commit to a git repository?

long: git log shows me who created the commits, when and what are the commit comments. So I can know an original author of a commit. If such commit was pushed to a feature branch by the original author, I'd like to check who merged this commit to the production branch.

Enticement answered 26/11, 2013 at 8:56 Comment(1)
Your question is a little unclear, you don't care about finding out who merged a branch, right? You just want to know who pushed a group of commits to a remote repo?Henceforth
T
11

No, you would need an extra layer added to Git in order to record that kind of operation.
git log only display the committer and author, as recorded in the commit.
But that has no bearing on who is actually pushing said commit.

For instance, gitolite (an authorization layer) adds an audit trail mechanism, with logs.
See its log file format.

Tipi answered 26/11, 2013 at 8:59 Comment(1)
This is not what I was hoping for, anyway, thanks for the tip with gitolite.Enticement
D
1

You can see who has merged the branch. When you make git log --all you see all branches. There you can see the merge commits.

But the problem on Git is that you can define any author and email so you can't be sure that its correct.

If you need access control you need something like gitolite.

Distaste answered 26/11, 2013 at 9:0 Comment(0)
T
1

To see both who created a commit and who pushed it (e.g. a duplicate commit after a rebase) you can use git log --pretty=fuller. The author is shown after Author: and the pusher after Commit:.

Thyroiditis answered 19/10, 2022 at 12:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.