The question says it all. Is there a way to perform an action before a merge? I\'m guessing there\'s a way to make use of a pre-commit
hook, but I\'m not quite
Another nice workaround would be to add a shell script, call it like you want, then add these lines to the script:
git() {
if [ "$1" == "merge" ]; then
echo "seems to work like a charme"
fi
command git "$@"
}
git "$@"
Then make an
alias git="./my-pre-merge-script.sh"
Then you are good to go. You just added your own pre-merge hook. I know, that you do not have access to whatever arguments git would pass to a real pre-merge hook, but you can prepare files or whatever you want to prepare for merge now; I personally am very happy with this approach: I spent 2 or 3 whole days to find something for pre-merge, then I had to go with the pre-commit-msg which I did not find accurate enough for my needs. This solves all my problems. Hope this helps anybody in the future.