0

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?

asked Jul 22, 2010 at 1:20

3 Answers 3

1

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.)

answered Jul 22, 2010 at 1:27
Sign up to request clarification or add additional context in comments.

Comments

1

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.

answered Jul 22, 2010 at 1:40

Comments

0

If the "new commits" for submodules, I think you can run git submodule sync and git submodule update.

answered Nov 19, 2012 at 1:58

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.