1

How to see What was server time when I pulled changes from git?

I don't care about when the developer made changes and about his time zone. I care about when in server time the last 5 changes were pulled into the server, so I can compare it with other server logs.

user8411456
  • 347
  • 1
  • 5
  • 18
  • There is only 1 time, the time fomr the server should be equal to the time of all users. What time-difference are you afraid of ? – Luuk Feb 21 '23 at 12:30
  • my developer is in india, it's giving me gmt +5:30 time, while my server is gmt -7 time. what should be the right command? – user8411456 Feb 21 '23 at 12:46
  • This info is in this answer: https://stackoverflow.com/a/23900181/724039. (`git log --date=local`) – Luuk Feb 21 '23 at 12:56
  • @Luuk This is not pull time, it's commit time. – phd Feb 21 '23 at 13:18

1 Answers1

1

Git does not store the pull time anywhere for you, but it leaves traces on your file system. Among other things, git pull will change the files in .git/refs/remotes/origin.

If you look at

ls -la .git/refs/remotes/origin

each file there corresponds to a remote-tracking branch, and each file is most likely dated as of the last time it was changed through a pull, or a fetch. Or a push, too.

The most recent of the files in there is most likely dated the time when you last ran git pull or git fetch.

For example, I have an old sandbox on my computer:

$ ls -la .git/refs/remotes/origin/
-rw-r--r-- 1 me 32 Apr 13  2022 HEAD
-rw-r--r-- 1 me 41 Oct 22 15:02 ignore-revs
-rw-r--r-- 1 me 41 Oct 22 14:41 master
-rw-r--r-- 1 me 41 Oct 22 14:41 test-build

This tells me that I first cloned the repo into that sandbox on April 13, last fetched master and test-build on Oct 22 at 14:41, but now I can't say if fetched ignore-revs at 15:02 or if I pushed it from this sandbox.

joanis
  • 10,635
  • 14
  • 30
  • 40