0

I am working with other people on a project and would like to be notified in a timely manner if there is something to pull from GitHub (perhaps also other participants directly).

I was thinking about creating a cron-job that does git remote update every hour or so and my shell then checks git log HEAD..origin on every "render" of the prompt if there are any items in there. (via oh-my-zsh/lib/git)

Is there a better way to do that?

5
  • I'm not sure how that will fit into the git methodology... generally, unless it's that urgent, you could be doing a merge.
    – digitxp
    Oct 6, 2011 at 1:03
  • It should not merge, just update the log, so I can see if origin is ahead. No merge yet.
    – mmlac
    Oct 6, 2011 at 18:26
  • I think you're looking for a git fetch - it updates without merging.
    – Nic
    Oct 6, 2011 at 21:15
  • git remote update does a fetch for all remotes.
    – mmlac
    Oct 6, 2011 at 23:26
  • I haven't seen remote update used for awhile - seems most prefer git fetch --all (either way I stand corrected!)
    – Nic
    Oct 6, 2011 at 23:39

2 Answers 2

0

If you want to be notified when somebody else sent changes to the remote repository you should configure the post-receive hooks on that server, one of the sample scripts in the git source is used to send email to one or more address when the repository receive changes, github should support these scripts also.

That way you can know when to do a 'git pull' to update your repository.

I don't like the idea of the crontab job, it could lead to trouble if the changes from the server cannot be merged with your local repo.

1
  • Please look at my comment response to digitxp above. I will look into the hooks, thanks.
    – mmlac
    Oct 6, 2011 at 18:25
0

A post-receive hook on GH that runs a git fetch on your local machine sounds like it would achieve what you're looking for. It syncs the changelogs without merging the changes in.

5
  • How does the GH hook contact my local machine?
    – mmlac
    Oct 6, 2011 at 23:30
  • Over SSH if you're using Mac/Linux, or Windows as well if you'd like to have some fun!
    – Nic
    Oct 6, 2011 at 23:36
  • Sounds pretty tedious. I accept jhcaiced's answer, because he posted the same solution earlier. Thank you for your contribution.
    – mmlac
    Oct 6, 2011 at 23:51
  • It's actually fairly simple - we incorporated a post-receive hook that updates our servers automatically and emails us a summary of the push without too much headache.
    – Nic
    Oct 7, 2011 at 0:45
  • Going through email again requires now two active steps for me to do. I just do a periodic fetch and let my zsh-script check for logs from HEAD..origin to see if there are any updates ahead of me. Thank you for the suggestion.
    – mmlac
    Oct 7, 2011 at 3:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .