简体   繁体   中英

How can I record my local git push history?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM