Sylvain Berger
Sylvain Berger

Reputation: 117

How to check if a git repo was updated without using a git command

TL;DR I would like to be able to check if a git repo (located on a shared network) was updated without using a git command. I was thinking checking one of the files located in the .git folder to do so, but I can't find the best file to check. Anyone have a suggestion on how to achieve this?

Why: The reason why I need to do this is because I have many git repos located on a shared drive. From a python application I built, I synchronize the content of some of these git repo on a local drive on a lot of workstation and render nodes.

I don't want to use git because the git server is not powerful enough to support the amount of requests of all the computers in the studio would need to perform constantly.

This is why I ended up with the solution of putting the repos on the network server and syncing the repo content on a local cache on each computer using rsync

That works fine, but the as time goes by, the repos are getting larger and the rsync is taking too much time to perform. So I would like to be have to (ideally) check one file that would tell me if the local copy is out of sync with the network copy and perform the rsync only when they are out of sync.

Thanks

Upvotes: 0

Views: 94

Answers (1)

CodeWizard
CodeWizard

Reputation: 141946

Check the .git/FETCH_HEAD for the time stamp and the content.

Every time you fetch content its updating the content and the modification time of the file.

Upvotes: 1

Related Questions