# Enabling Branch protection:

### Creating a branch inside repository:

* Go to the repository and click on **new branch.**

<figure><img src="/files/vlzvOyt79kieRoJuN3yQ" alt=""><figcaption></figcaption></figure>

* Here I have created a branch named **DIGIT**
* After, go to that branch in the same repository.

<figure><img src="/files/FSehdZKctKcJ0voubPht" alt=""><figcaption></figcaption></figure>

### Creating branch protection rule:

* Branch protection rule states that, how to manage the branch restrictions/permissions in GitHub.

NOTE : You must have admin access orelse you have to be a codeowner to make these changes for branch restrictions/permissions.

* Open <https://github.com> and choose any repository.Go to the main page. Click on **settings.**

<figure><img src="/files/GXI3duBncd5ZqGU5NZQi" alt=""><figcaption></figcaption></figure>

* Click on **branches**

<figure><img src="/files/ii29rnnpp9Ei1IK84ZyI" alt=""><figcaption></figcaption></figure>

* If you click on the **Edit** rules you can able to see the rules which are applied for that branch.you should follow the rules when ever you are going to made any changes to that branch and pushing it.
* If you want to create new branch protection rule click on **Add Rule.**

<figure><img src="/files/uRpj0jTmEniClhujnzPd" alt=""><figcaption></figcaption></figure>

The common restrictions we are following to merge branches are :

1.Requires pull request

2.Requires approvals from CODE OWNERS

* Only the **CODE OWNERS** can have access to merge and makes changes to these rules.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digit.org/platform/guides/operations-guide/gitops/enabling-branch-protection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
