Is it possible to merge two branches only if there are no new commits on the target branch?
Say we have master branch with commits:
1.1.0 -> 1.1.1 -> 1.2.0(new)
And dev branch with commits
1.2.0-0 -> 1.2.0-1 -> 1.2.0-2
Say i now want to merge 1.2.0-2 into master to make a new 1.2.0 but fail if the existing commits on master have not been merged into dev. This merge is automated, so i don't want any conflicts or any unexpected behaviour.
Eg imagine that master was merged into dev to make 1.2.0-0, master then receives a hotfix 1.1.1. Then finally the tested 1.2.0-2 on dev should be merged to master, but conflicts or has unexpected behaviour due to presence of 1.1.1. I want the process to fail here, and force a merge first of 1.1.1 into dev, testing and then a merge back.
I have scanned the git docs but can't see a command option that will prevent the merge in this case.
One solution is to check first if the last commit on master exists in dev branch, but ideally this will just be a merge command.