How do I check the date and time of the latest git pull
that was executed? I frequently need to know when the code changed on a server when something goes wrong.
Thanks! Chirag
How do I check the date and time of the latest git pull
that was executed? I frequently need to know when the code changed on a server when something goes wrong.
Thanks! Chirag
The git show
command shows the date of the most recent commit. This isn't the date at which the commit was pulled to the local repository, but Git doesn't keep such pull information.
You may be able to find the time of the last pull using the ctime (creation time) of the files on the server. For example:
ls -lct
shows the ctime of each file, sorted with the most recent first.
In a non-bare repository (and a bare repository doesn't make sense for git pull
), git logs all changes to branch tips and the current branch idea in "reflogs", in .git/logs
. You can view these using git log -g
.
However, although the log files do have timestamps, it doesn't appear that git log -g
will print it. However, if you take a look at .git/logs/HEAD
for example, you'll see that the format is quite simple to parse- it consists of what the ref (or HEAD) changed from, changed to, who changed it, when and an activity message.