Hello Thomas, for example: This is the example hooks from http://stackoverflow.com/questions/2524101/git-how-do-we-verify-commit-messages-for-a-push that I tired: #!/bin/bash long_subject=$(git show master..Lingfei_test2 --pretty=format:%s | line | line | egrep 999) #long_subject=$(git log --pretty=tformat:%s | line | egrep 999) if [ -z "$long_subject" ]; then echo "error: commit subject's comments not include '999'" echo " $long_subject" exit 1 fi But when I tested on my local repo and tried to push the new changes into the server repo, and this update hooks is only check the previous commit comments since either git show/git log the latest commit comments is always the previous one that I pushed. Not sure if this is clear? and what I want is compare the new commit push comments to check if the comments are meet prerequisites, (let's say if the commit comments include '999', then the push success, else exit). Thanks Ling On Wednesday, September 4, 2013 7:39:41 AM UTC-4, Thomas Ferris Nicolaisen wrote:
> > > On Wednesday, September 4, 2013 1:31:26 PM UTC+2, Ling wrote: >> >> Thanks Thomas, And yes I had read this and also I tried with git log >> but this won't works since git log is only created after the push, which >> means it won't compare the new push comment, it only compare the previous >> pushed comment to trigger the hooks. since what I need is trigger the hooks >> when new push comment not meet my prerequisites. >> >> Thanks >> Ling >> > > I'm not really sure what you mean. Can you share with us the hook you > currently have and an example of where the behavior is unexpected? > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
