Can I push changes only to certain branches and raise an exception if an integrate shouldn't be made to others? A and B are branches

A ==> B // allowed
B ==> A // forbidden
C ==> B // allowed
A ==> A // forbidden
  • What are A and B, exactly? A push is different from a merge. – Stevie Howard May 16 at 15:54
  • Thanks, I updated it. A and B are branches. Oh, really, it is different? I am new to git, thanks – Daniel Stephens May 16 at 15:55
  • What is your host? Many services (GitHub / GitLab / BitBucket) will allow you to protect branches, though it may be a bit basic for what you're after... You may get what you're after from reading up about hooks, specifically server-side - git-scm.com/book/en/v2/Customizing-Git-Git-Hooks – Attie May 16 at 15:57
  • From your question, it looks like you're just trying to protect the A branch... is that correct? – Attie May 16 at 15:58
  • Yes, correct. I am using my own personal git server. I just want to avoid that another dev by accident merges data into a branch where it doesn't belong. – Daniel Stephens May 16 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.