github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/docs/howto/protect-branches.md (about)

     1  ---
     2  title: Protect Branches
     3  description: Branch protection rules prevent direct changes from being applied to your important branches.
     4  parent: How-To
     5  redirect_from: 
     6    - /reference/protected_branches.html
     7  ---
     8  
     9  # Branch Protection Rules
    10  
    11  Define branch protection rules to prevent direct changes and commits to specific branches.
    12  Only merges are allowed into protected branches. Together with the power of pre-merge [hooks][data-quality-gates],
    13  you can run validations on your data before it reaches your important branches and is exposed to consumers.
    14  
    15  You can create rules for a specific branch or any branch that matches a name pattern you specify with [glob](https://en.wikipedia.org/wiki/Glob_(programming)) syntax (supporting `?` and `*` wildcards).
    16  
    17  ## How it works
    18  
    19  When at least one protection rule applies to a branch, the branch is protected. The following operations will fail on protected branches:
    20  1. Object write operations: **upload** and **delete** objects.
    21  1. Branch operations: **commit** and **reset uncommitted changes**.
    22  
    23  To operate on a protected branch, merge commits from other branches into
    24  it. Use pre-merge [hooks][data-quality-gates] to validate the changes before
    25  they are merged.
    26  
    27  Reverting a previous commit using `lakectl branch revert` is **allowed** on a protected branch.
    28  {: .note }
    29  
    30  ## Managing branch protection rules
    31  
    32  This section explains how to use the lakeFS UI to manage rules. You can also use the [command line][lakectl-branch-protect] and [API][api].
    33  
    34  ### Reaching the branch protection rules page 
    35  
    36  1. On lakeFS, navigate to the main page of the repository.
    37  2. Click on the _Settings_ tab.
    38  3. In the left menu, click _Branches_.
    39  
    40  ### Adding a rule
    41  
    42  To add a new rule, click the _Add_ button. In the dialog, enter the branch name pattern and then click _Create_.
    43  
    44  <img alt="Adding a branch protection rule" src="{{ site.baseurl }}/assets/img/add_branch_protection_rule.png" style="max-width:500px; display:block; margin-left:auto; margin-right:auto;">
    45  
    46  ### Deleting a rule
    47  
    48  To delete a rule, click the _Delete_ button next to it.
    49  
    50  ![Deleting a branch protection rule]({{ site.baseurl }}/assets/img/delete_branch_protection_rule.png)
    51  
    52  [data-quality-gates]:  {% link understand/use_cases/cicd_for_data.md %}#using-hooks-as-data-quality-gates
    53  [lakectl-branch-protect]:  {% link reference/cli.md %}#lakectl-branch-protect
    54  [api]: {% link reference/api.md %}