I am looking for a way to check a git remote for changes since my last fetch.
I understand that git works on the principal of having the fetch a remote see changes, and yet I know of many continuous integration tools such as “TeamCity” that are able to “ping” a remote for changes.
I would like to know how build agents etc do these checks so that I can write my own tool for notifying people of changes to a repo.
what git command would you use to check for changes on a git remote?
would git ls-remote . suffice?
Build agents do it generally by having the server ping them on changes and that is accomplished with a
post-receivehook that sends a HTTP POST with the new commit SHA. I don’t see a reason to check the remote without fetching.git ls-remotewould get you the commit SHA’s which you can obviously compare to your local ones but that wouldn’t get you any info about how many commits are done.