search

Home  >  Q&A  >  body text

How to control merge behavior in git

Assume that there are two branches A and B in the git library. How to set it to achieve the following effect:
Allow B merge into A, and vice versa

仅有的幸福仅有的幸福2791 days ago765

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-05-02 09:51:46

    vi .git/hooks/prepare-commit-msg

    #!/bin/sh
    case "," in
        merge,)
            grep "'A'" ; 
            if [ $? ];then
                echo '禁止合并A merge into B';
                exit 1;
            fi;;
      *) ;;
    esac

    reply
    0
  • Cancelreply