In a common (git-based) development workflow, one maintains a master
branch and a next
(or dev
) branch which is used for testing purposes:
- feature branches begin from
master
and are merged intonext
for testing. If deemed stable, feature branches can be merged intomaster
. master
is periodically merged intonext
next
is periodically rewound (say, after a release).- The
next
branch should never be merged into themaster
branch
It would be useful to be able to automatically prevent merges of next
into master
, either directly or via another branch based on next
. How can one accomplish this using git?
Note: as described in this question, it is possible to use git hooks to prevent these types of merges on a remote repository one has full access to. However, this is (presumably) not possible with services like BitBucket or GitHub, so I seek a solution that works with a local repository, or one which can be used with a remote repository that one only has limited administrative access to.