1

I'm fairly new to GitHub. I wanted to confirm if there is a layer configuration in GitHub where we can restrict which branch can commit to what. Here's the situation:

  1. Only Develop branch can commit to QA/Test branch
  2. Only Test branch can commit to the Master branch.

Lastly, if I wanted to create a Test branch, which branch should it be created from. Should it be created from the Develop or the Master branch?

Thank you.

torek
  • 448,244
  • 59
  • 642
  • 775
  • 1
    Hi welcome to StackOverflow! What do you mean by "a branch committing into another branch"? Do you mean merge? So is your question, is there a way to restrict which branch can be the base branch when a certain branch is the compare branch? – TheIceBear Jan 24 '22 at 12:18
  • Related to your second question (and please try to keep each post to one question). There is no rule in Git or GitHub where any branch with a certain name should be created from. There are some workflow principles on what to call which branches, but there is no technical right or wrong Git rule in a workflow. It sounds as if you are trying to emulate a Gitflow workflow. If so, see the section on "Release branches" here: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow – TheIceBear Jan 24 '22 at 12:23
  • Thanks for the welcome! "So is your question, is there a way to restrict which branch can be the base branch when a certain branch is the compare branch?" Yes, this is what I actually mean. Is there a way to do this? – Katherine Darunday Jan 24 '22 at 15:33
  • I do not think so. You can restrict who has access to a branch with a certain name, but to Git these names are only labels for humans to read without any technical meaning. You could lock the master branch to a specific person or team, but then you still rely on that human or team of humans to remember to merge branches according to your workflow. – TheIceBear Jan 24 '22 at 15:41
  • Also worth mentioning (and the reason I snipped out the [tag:git] tag): *Git* has no restrictions at all. Git*Hub* adds the ability to put in restrictions, but they're limited to whatever GitHub have decided to offer. This mostly amounts to "user A can do anything, but user B can only do operations Y and Z on GitHub". – torek Jan 25 '22 at 01:02

0 Answers0