git-pre-receive 335 B

123456789101112131415161718
  1. #!/bin/bash
  2. #hook/pre-receive
  3. #CONFIG
  4. PRODDIR="www"
  5. read oldrev newrev refname
  6. if [ $refname = "refs/heads/prod" ]; then
  7. echo "===== UPDATE REPOSITORY ====="
  8. unset GIT_DIR
  9. cd ~
  10. cd $PRODDIR
  11. git add .
  12. git commit -m "Auto Commit"
  13. echo "====== OK ====="
  14. else
  15. echo "Warning Commit not deployed, please use prod branch"
  16. fi