1

Can I set up a repository to allow git push only between specific "allowed" branches, and raise an exception if if a push is attempted to a "forbidden" branch?

Example:

A, B, C are branches.

A ==> B // allowed
B ==> A // forbidden
C ==> B // allowed
A ==> A // forbidden
5
  • What are A and B, exactly? A push is different from a merge. May 16, 2019 at 15:54
  • Thanks, I updated it. A and B are branches. Oh, really, it is different? I am new to git, thanks May 16, 2019 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, 2019 at 15:57
  • From your question, it looks like you're just trying to protect the A branch... is that correct?
    – Attie
    May 16, 2019 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. May 16, 2019 at 18:21

0

You must log in to answer this question.

Browse other questions tagged .