I have a post-receive hook that create a file after a push on master branch

branch_name=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "master" == "$branch_name" ]; then
    touch OK_push.txt

Is it possible to do the same thing after a merge (or pull) between one branch on master branch?


If you read through the list of available hooks, you see that there is a post-merge hook...

...but it's not clear from your question that this will do what you want. A post-receive hook runs on a remote git repository after receiving updates from a client, while a post-merge hooks runs in your local repository after a merge operation (including git pull, unless you've set git to rebase rather than merge).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.