0

As mentioned in the question, after or at the time of pulling modified code to my production base i want to notify others about changes are going to be done to my production base or changes took place in production base through emails.

git-hooks mentioned here doesn't match with my criteria.

Can any one suggest me a hook/script/gem that can do my job with example?

Thanks a lot in advance.

EDIT: Can any one give me a sample of post-merge hook

Aparichith
  • 1,452
  • 4
  • 20
  • 40

1 Answers1

0

it is duplicate of Is there any git hook for pull?

For customising your request and refer this url https://gist.github.com/sindresorhus/7996717, you can prepare the hook post-merge as below

#/usr/bin/env bash

# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.

changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"

check_run() {
    echo "$changed_files" | mailx -s "changes found on production server!" your.mail.box@mail.com
}

# In this example it's used to send mail if there are any files changed.
check_run 
Community
  • 1
  • 1
BMW
  • 42,880
  • 12
  • 99
  • 116
  • i have less knowledge in shell scripting. When i run with your code it tells me changed_files not found. how to assign multiple values to a variable in shell scripting? – Aparichith Dec 12 '14 at 04:21