> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/code-repository/use-harness-code/pull-requests/create-pr.md).

# Create PRs

Create PRs in Harness Code

Pull requests (PRs) foster collaboration within your team, ensuring code changes go through required reviews, approvals, and checks before being merged to the base branch.

### Create a pull request <a href="#create-a-pull-request" id="create-a-pull-request"></a>

1. In your repository, go to **Pull Requests** and select **New Pull Request**.
2. Select the *base branch* and the *compare branch*, which is the branch that you want to merge into the base branch.
3. Add the **Title** and **Description**.
4. If this PR is ready for review, select **Create pull request**.

   To save a PR as a draft, select the dropdown next to **Create pull request**, and then select **Create draft pull request**.
5. [Request reviews](/code-repository/use-harness-code/pull-requests/review-pr.md) and then [merge the PR](/code-repository/use-harness-code/pull-requests/merge-pr.md).

{% hint style="info" %}
You can also create PRs by [comparing branches](/code-repository/use-harness-code/collaborate-and-develop/branch.md#compare-branches-to-create-a-pull-request) and when [committing changes](/code-repository/use-harness-code/collaborate-and-develop/commit.md#create-a-commit).

To create a PR from a [forked repository](/code-repository/use-harness-code/manage-repositories/fork-repo.md#create-a-pull-request-from-a-fork), use the repository selector in the compare view to choose between the fork and upstream repository.
{% endhint %}

#### Compare & Pull Request Banner <a href="#compare-and-pull-request-banner" id="compare-and-pull-request-banner"></a>

When a commit is pushed to a branch without an existing pull request, Harness Code Repository displays a banner at the top of the repository page, allowing the user to quickly create a PR from that branch.

<figure><img src="https://942965363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoTP6ysjQCQlt5GlFHRfs%2Fuploads%2Fgit-blob-b389d6523f4dd7b88454cbbba4d51522ce865fe0%2Fpr-banner-on-new-change.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**BANNER VISIBILITY**

The banner appears for **2 hours** after changes are pushed to a branch. Once this time window passes, the banner no longer displays on page load.

Only the **three most recently updated branches** are eligible to show the banner.
{% endhint %}

### AI PR Summary <a href="#ai-pr-summary" id="ai-pr-summary"></a>

Harness AI can automatically generate intelligent summaries for your pull requests based on the code changes and diff. This feature helps streamline code reviews by providing context-aware descriptions of what changed and why.

#### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

To use AI PR Summary, Harness AI must be enabled in your account settings:

1. Navigate to **Account Settings** in your Harness account
2. Go to the **Harness AI** section
3. Enable **Harness AI** by toggling the switch to **ON**

#### Generate an AI summary <a href="#generate-an-ai-summary" id="generate-an-ai-summary"></a>

When creating or editing a pull request:

1. Open your pull request in Harness Code Repository
2. In the PR description area, click the **AI Summary** button
3. Harness AI will analyze the PR diff and generate an intelligent summary describing:
   * What changes were made
   * The purpose and impact of the changes
   * Key modifications across files

The AI-generated summary provides a concise overview that helps reviewers quickly understand the scope and intent of your changes, making the code review process more efficient.

{% hint style="info" %}
AI PR Summary requires Harness AI to be enabled in your account settings and may take a few moments to generate based on the size of your PR diff.
{% endhint %}

### Close a pull request <a href="#close-a-pull-request" id="close-a-pull-request"></a>

If you decide a pull request is invalid or not ready for review, you can close it.

1. In your repository, go to **Pull Requests**, and select the PR you want to close.
2. Select **More options** (⋮) next to **Squash and merge**.
3. Select **Close pull request**.

To reopen the PR, select **Open for review**.

{% @harness-feedback/feedback module="code-repository" pagePath="code-repository/use-harness-code/pull-requests/create-pr" %}
