Search code examples
gitgithooksgit-post-receive

Git post-receive - how to check if pushed branch is merged with master


In our team we are usually pushing all tasks into separate branches, and after that release-manager review those branches and merge them into 'master' branch

Sometimes team-members forget to merge their branches with master branch(before pushing) - so what I'm trying to do is - output a message "Please merge with master" after user push - I assume I need to check something on post-receive hook on remote.. is there some examples?.. or what I should basically do ?

update: main reason for this - minimize number of potential conflicts (since committer(not release-manager) will resolve them)


Solution

  • If git cherry new-branch master has any output, then someone didn't rebase before pushing.