Sylvain
Sylvain

Reputation: 3220

How to know when something is pushed into a git repository

I'd like to know how to check if something is committed to a repository through git. The idea is to take the committed files into a code review tool.

Upvotes: 1

Views: 300

Answers (2)

Colin Burnett
Colin Burnett

Reputation: 11548

Perhaps the simplest would be to run git-count-objects and see when the number of objects increases. Poll every 5 minutes or as you see fit.

$ git count-objects -v
count: 13
size: 568
in-pack: 48
packs: 1
prune-packable: 0
garbage: 0

"count" is unpacked, "in-pack" is packed, so "count"+"in-pack" should increase with a commit by at least one.

Or use a hook.

Upvotes: 0

Aaron Maenpaa
Aaron Maenpaa

Reputation: 123030

You want a hook that pushes the new code into the code review tool: http://git-scm.com/docs/githooks

Upvotes: 6

Related Questions