Take control with branch restrictions

By on September 16, 2013

With Git, branching has never been easier — especially with the introduction of amazing new workflow capabilities such as git-flow. Some development workflows require that specific developers oversee merges into the master or release branches, while other developers work on bug-fix and feature branches.

Bitbucket’s latest feature, branch restrictions, lets you turn this “gentlemen’s agreement” into a seamless, enforceable process, reducing confusion and time wasted backing out changes that were merged prematurely.

Enforce your workflows

At the heart of branch restrictions is a new repository write permission that allows you to control who can commit to specific branches in a repository. Branch permissions are set on a per-repository basis by specifying a user or group who already has access to a given repository.

Bitbucket Branch restrictions

Restrictions are based on explicit branch names, or you can use advanced branch permissions to match multiple branches (or tags) using pattern matching. For example, use an * (asterisk) in a rule: “f*r” matches foobar and footer. Establishing naming conventions based on roles or functional area (e.g., “contractor_” or “userauth_”) makes it even easier to set and standardize permissions throughout your organization.

Edit-undo becomes a thing of the past

Simplify your Git repository management

Bitbucket is free individuals and teams of five or less, and includes unlimited repositories. Start a free trial today and get up and running in a matter of minutes!

Create a free account
  • henry

    Is this just for git?

    • Egor

      +1, really want to see this for mercurial.

      • Lehóczky Zoltán

        This works for mercurial too! For the prevention of deleting certain branches for mercurial it’s the same with bookmarks.

        • Egor

          Awesome, thanks!

  • mrts

    Love it, helps devs not to shoot themselves into foot! Thanks!

  • Martin Geisler

    I’m disappointed to see the blog post starting like this “With Git, branching has never been easier” when you know very well that Mercurial also allows easy branching! The feature even works for Mercurial, so please have the courtesy of promoting both systems equally.

    • AngelEzquerra

      I agree. Both got and mercurial make it very easy to branch your code. If the feature works with both DVCSs, why Melvin one but not the other?

    • jkirkby

      yes mercurial has branching but the article says “With Git, branching has never been easier” mercurials method of branching and pulling /updating the branch is stupid. why do i need to run a separate command to update that branch when i already told it to pull??

  • Anonymous

    How does one get this to work with tags? Mentioned, “match multiple branches (or tags) using pattern matching” but so far nothing has worked. Even * rule doesn’t prevent tags from being pushed. Have also tried refs/tags/* and */tags/*.

  • Art Vandelay

    Is there a way to enforce a code freeze in a branch?

    • Raj Sarkar

      you could limit pushes on a branch to just to the lead or release manager, which would effectively enforce a freeze