1

We have several teams which are working on multiple branches, I want to allow them only to merge from master and develop and not from each other, because we had an issue in which someone merge another team's branch and pushed to master (that was a hell of a weekend)

So naturally I've try to play with the Pre-Merge-Commit hook, but it seems to have its own problem and I can't be sure what is the branch to merge from (correct me if I'm wrong)

What is the best way to keep it simple and allow them to only merge from the branches I choose?

Thanks :)

maya li
  • 33
  • 3
  • 1
    Code reviewed? Or merged without code review? Why not caught in code review? are some questions worth thinking then. – Shridhar R Kulkarni Sep 08 '20 at 13:36
  • https://docs.github.com/en/github/administering-a-repository/configuring-protected-branches – Shridhar R Kulkarni Sep 08 '20 at 13:40
  • 1
    Does this answer your question? [Enforce git branch policies](https://stackoverflow.com/questions/23839718/enforce-git-branch-policies) – Shridhar R Kulkarni Sep 08 '20 at 13:42
  • Note that once I clone your Git repository, my clone is *mine* and you cannot enforce any rules at all. You can only enforce rules on commits I offer *to* you. So that is what you must do: choose which commits you will accept from others. That's what code review is all about. – torek Sep 08 '20 at 23:42
  • Thanks guys, but it's not what I'm looking for. Code reviews are great, but someone can just push without passing a review, the other solutions are for GitHub – maya li Sep 09 '20 at 12:20

0 Answers0