0

I want to know at what time I pushed which commit to the upstream.

AFIAK git does not provide this out of the box.

Is there a way to create a hook which records my git push history?

I am looking for a solution which runs on my machine. I don't have permission to configure the central upstream git server.

guettli
  • 25,042
  • 81
  • 346
  • 663
  • 2
    _"git does not provide this out of the box"_ yes. git does not log pushes/pulls. git is distributed so if it did, what would the value be? --- _"create a hook which records my git push history"_ probably. Why not have a go? – evolutionxbox Feb 25 '21 at 11:01
  • 3
    Does this answer your question? [Is there a way in git to obtain a push date for a given commit?](https://stackoverflow.com/questions/6795070/is-there-a-way-in-git-to-obtain-a-push-date-for-a-given-commit) – Liam Feb 25 '21 at 11:01

1 Answers1

-1

A hook is just a shell script, so there's no reason you can't write one that does what you describe. Since you're limited to client-side configuration, there are some limitations; if you're wanting this just to collect information about your own usage of your repo, it shouldn't be a problem, but if you're trying to institute collection of this data for a team, then at best you're pretty much at the mercy of the team's willingness to cooperate.

By the same token, a hook is just a shell script; so you'll have to figure out things like where you want to store the data you collect, in what format, etc. There are no conventions or anything for this, since - as you say - this is not git functionality.

So beyond that, unless you've tried to write such a hook and have a specific question about some challenge with writing it, there's not much more to say about it.

Mark Adelsberger
  • 42,148
  • 4
  • 35
  • 52