PaulD
PaulD

Reputation: 625

Determine the time that a git commit is pushed to a remote branch (e.g., origin/master)

Within git, a commit is time stamped with the time that the commit was generated on the local machine. Though this timestamp has uses, for my purposes this value will not work.

Rather, I need to determine the time that the commit is merged/fast-forwarded into the remote branch.

My first attempt was to use the time found by executing: git reflog origin/master --date=local

This partially works, but it does not give information about the full set of commits for all authors.

Upvotes: 1

Views: 68

Answers (1)

LightBender
LightBender

Reputation: 4263

Commits operate in a way that is very similar to books. A book is published, and every copy after that is an instance of that book. It's easy to determine if a copy is authentic and it's easy to determine when the original was published. Unfortunately it is much harder to determine when any given copy was purchased and almost impossible to determine the last time it was read.

Your best bet is to use the electronic equivalent of a receipt or a card catalog. You could use a hook to log push transactions which will allow you to cross reference pushes with commits and use that to look up the information, but git does not provide this information natively.

Upvotes: 1

Related Questions