On 03/05/2008, Ping Yin <pkufranky@xxxxxxxxx> wrote: > I am in a company environment and i want to enforce a policy that > every commit must be reviewed before pushed to central repository. I > think i can use hooks to enforce such kind of policy. This sounds likely, yes. > One way i want to try is to check in the hook whether every pushed > commit has a "Reviewed-by " line . Any suggestion? Assuming this is enforced either through a template (see: commit.template in git-config(1)), or as part of being added by the committer, then in GIT 1.5.4 onwards there's a commit-msg hook which will do this for you. Something like: test "" = "$(grep '^Reviewed-by: ')" || { echo >&2 "Message must have a Reviewed-by line present." exit } > And one question, how to add a "Reviewed-by" line automatically? There's an example of that by way of a SOB in the commit-msg hook. -- Thomas Adam -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html