Git merging issue

Following is the git flow that we are about to follow. But the problem is we have to restrict people from re basing the feature branch from the developer branch. We should only let people rebase their feature branch from the release branch.
Restriction should be that when a user trying to merge a feature branch which is created from the developer branch or re based from the developer branch that merge should be rejected. Is that can be done?
enter image description here

  • Azure Cloud Services and Git continuous deployment?
  • git-tf tells me “Could not lock” when checking in; how can I fix it?
  • Bitbucket Commit Push History
  • Remove folder and its contents from git/GitHub's history
  • egit does not show label decorations
  • Using maven-release-plugin with git-1.8.5
  • How can I clone a git repository and keep remotes?
  • Using a git subrepo which has ANOTHER git subrepo in a mercurial repository, is this possible?
  • GIT list of new/modified/deleted files
  • Git Submodule or fork
  • how to identify branches that need to get merged in git
  • git stash blunder: git stash pop and ended up with merge conflicts
  • 2 Solutions collect form web for “Git merging issue”

    Hope I understood your question. You are looking for a way to restrict developers from creating feature branches from develop.

    Below code snippet will help you to identify parent branch of a feature branch. You may have to add this to server side git pre-receive hook script.

    branch=`git rev-parse --abbrev-ref HEAD` 
    parent_branch=`git show-branch -a 2>/dev/null | grep '\*' | grep -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'`
    if $parent_branch="develop"; then
        echo "please use release as base branch"
        exit 1

    As mentioned in “Authorization for Merge requests”, you have two ways to enforce authorization.

    Since in your case you don’t want rebase on top of master, I would consider the forking workflow, where master/hotfix branches are in one repo, feature/dev branches in another repo, where developers are registered.

    That way, developers can only make merge request to master, with a possibility for the integrator to accept/reject a merge request based on its provenance.

    Git Baby is a git and github fan, let's start git clone.