shell - Execute git command in hook post-commit -
i have post-commit hook. count commit number every time commit on repo. wrote :
#!/bin/sh commit_number=$(git shortlog | grep -e '^[ ]+\w+' | wc -l) echo "$commit_number"
every new commit, terminal printing 0 ... don't why. if launch command after commit within terminal have right count.
try :
cd .. commit_number=$(env -i git shortlog | grep -e '^[ ]+\w+' | wc -l) echo "$commit_number"
git shell command hook post-commit
No comments:
Post a Comment