tags:

views:

31

answers:

2

Hey,

we have a Git remote repository (in a way, our "central" repository) on the server of our site and the site is run off that repository. Just pushing to the repository does not update the site, we have to run a little script on the server first.

Now I want to display a little warning when there are new commits that haven't been applied yet. Which Git command can I use to find out whether there are commits that have been pushed but not yet applied?

+1  A: 

You could store the SHA of the commit that is currently "live" on the site, and then compare it with the SHA returned by git rev-parse <name of remote>/master.

(You may need to run a git fetch <name of remote> first to make sure you have the latest info for that remote.)

Amber
Thank you, I will try that.
Franz
+1  A: 

Rather than warning users about the web view of the repo not being up to date, why not keep it up to date all the time? The default behavior (when enabled) of the post-update hook should do what you want.

robert