2

If user A pulls in changes from master in a branch B and this is possible without a merge (no conflicts), is there a possibility to see who did this pull in Git history (or possibly other Git metadata)? I am assuming that the pull is pushed to the corresponding branch on a central Git repository. Is there a "push" history in Git?

Wolfram
  • 8,044
  • 3
  • 45
  • 66
Gustave
  • 3,359
  • 4
  • 31
  • 64

2 Answers2

3

No, this information is not automatically recorded anywhere. You would need to have something like GitLab or GitHub, that handles (among others) authentication/authorization and would be able to log that kind of information.

Wolfram
  • 8,044
  • 3
  • 45
  • 66
  • This should not be related to authentication. Plain Git records the names and email of committers, even if no security is involved at all. – Gustave Aug 05 '15 at 11:55
  • But not for a push, which is kind of a «meta» operation. – Wolfram Aug 05 '15 at 12:06
  • Thanks! Are you shure it's not recorded in some maybe obscure corner? – Gustave Aug 05 '15 at 12:10
  • It could be that the IP is logged on the remote system doing the push (e.g. in `auth.log` or similar). This depends on the log configuration and is completely independent to Git, but you might get behind who initiated the push. – Wolfram Aug 06 '15 at 05:51
3

Git stores that information locally, but it is not transmitted to a remote repository when you push it.

You can see the result of a fast-forward pull from master (locally) by

git reflog --format=full

Example output:

commit defed1f
Reflog: HEAD@{0} (a <a@none>)
Reflog message: pull origin master: Fast-forward
Author: b <b.none>
Commit: b <b.none>
(...)
Gustave
  • 3,359
  • 4
  • 31
  • 64
  • Interesting! However, this should always give you the locally configured user. I don't think there is a remote reflog that could tell you about who pushed. But if it would exist, that should contain what you are looking for, right? Also mind that the reflog might be cleaned periodically: http://git-scm.com/docs/git-gc. – Wolfram Aug 06 '15 at 07:36
  • No, the user is stored permanently in the file ./.git/logs/refs/heads/BRANCH. You can verify this by changing the configured user. I will have a look at the logs of remote branches within the local repo as a next step. – Gustave Aug 06 '15 at 09:07