I have master
branch and other branches from my team members. master
is sync with the product. I want to have another additional commit that upgrading version (change a file content say 'release.md') when an MR is merged into master from other branches, no matter what changes have been made.
This is for a gitlab v11.10.4, running on ubuntu 16.04 system. At the beginning, I want to set a git hook (update hook) on gitlab server-side. In the script, I need to do: 1) check if target merge branch is master 2) if it does, check the commit's message is not like "upgrading version" 3) if not then add an additional commit before merge.
touch release.md
git commit -a -m "upgrade version"
I know that in an update hook I could get args which are "refname", "oldrev" and "newrev", theoretically I could parse info from this to finish step 1) and step 2). but I have no idea how to add additional commit to this branch.
It is easy to have it in local hook (git add . blahblah), but in that way every developer in my team gonna need to maintain a hook file in .git of any repo. Which is error prune. Any idea and suggestions?