To use this hook:
- add the
prepare-commit-msg
file at.git/hooks/prepare-commit-msg
and edit as needed - make it executable:
chmod +x .git/hooks/prepare-commit-msg
- disable fast-forward merges:
git config branch.master.mergeoptions "--no-ff"
- that's it!
NOTE: after a failed merge from a forbidden branch, the working tree will still be in a MERGING state. To discard the local working copy state, run:
git reset --merge
Hello Mark,
inspired from your script, I'll change the regex on line 24. Perhaps you are interested in why.
My git log is:
I don't know if git can give other attributes to the branch, so the regex will become something like
/Merge .*?branch '(.*?)'/
Regards,
HUjuice