Customers have installed this app in at least 137 active instances.
    by Saravfor Bitbucket Server 2.12.1 - 3.11.6
    Sarav supports this app.

    Get support

    Get it nowFree app

    Protect Branches is pre receive hook to prevent accidental branch deletes from a push

    Protect Branches is pre receive hook to prevent accidental branch deletes from a push

    Enable Hook

    Configure Regex Pattern of branch name

    Pushing branch delete will give commit error

    After you uploaded Protect Branches plugin . Enable the hook in repository pre receive hook section "Disable Branch Deletes"

    When you enable , You will see configuration screen to enter Regex value of branches you will need to protect. for example to protect master and feature branches , you will need to use (master|feature/.*)

    Git push of branch delete will give commit error message

    More details

    For example: If you would like to save master and develop branches you would provide something like (master|develop).

    First Release Provide basic functionality of preventing delete. We will add more feature to this plugin in next releases

    Please fill bug request in bitbucket https://bitbucket.org/sjagadeesan/protectbranches/issues

    Update About Plugin Upgrade:

    There has been lot of request for the plugin upgrade to new bitbucket server version.I will be working on a upgraded version this week and will release it ASAP.

    User reviews

    Sign in to write a review
    by Henning Moll on 2015-04-22
    The plugin already supports protecting tags. You need to understand how the specified pattern is handled by the plugin: Suppose an arbitrary, complex pattern X. Internally this pattern is just prefixed with "refs/heads/", So X will become refs/heads/X (eg "(branch1|branch2)" will become "refs/heads/(branch1|branch2)") You can now add some tag references by writing the pattern like X|refs/tags/(Y) Example: (branch1|branch2)|refs/tags(tag1|tag2) will protect branches branch1 and branch2 as well as tags tag1 and tag2. Unfortunately, the message "You are not allowed ..." is not correct for tag names. The wording is fixed to "branch" and the name of the ref is missing the first character if it is a tag. For example, if you try to delete the protected tag "foobar", the message will look like this (oobar): remote: You are not allowed to delete 'oobar' branch,Revert your delete commit and retry push
    2 out of 2 found this review helpful
    Was this review helpful?YesNo
    by Mark Gillespie on 2015-03-03
    Stops pushes that delete branches, but it does not prevent Stash itself deleting the branches (e.g.) a forgotted tick on the pull request "Delete Source Branch After Merging". If you can get it so Stash can't delete it either, it would be perfect
    5 out of 5 found this review helpful
    Was this review helpful?YesNo
    by Joseph Murray on 2014-09-10
    Simple plugin does the job of protecting our master branch . If it can handle tags as well it would be good
    Was this review helpful?YesNo


    Sarav provides support for this app.

    Vendor support resources


    Find out how this app works.

    See existing Q&A in Atlassian CommunityAsk a question in the Atlassian Community

    Atlassian-hosted discussions connect you to other customers who use this app.


    Version 1.0 Bitbucket Server 2.12.1 - 3.11.6 Released 2014-09-09


    Initial Release


    1. Log into your Bitbucket instance as an admin.
    2. Click the admin dropdown and choose Add-ons. The Manage add-ons screen loads.
    3. Click Find new add-ons from the left-hand side of the page.
    4. Locate Protect Branch Delete via search. Results include app versions compatible with your Bitbucket instance.
    5. Click Install to download and install your app.
    6. You're all set! Click Close in the Installed and ready to go dialog.

    Similar apps