# Quickstart for pull requests

Propose your first change and take it all the way from your first commit to a merged pull request.

A pull request proposes changes on a branch separate from the main code base so others can review the changes before they are merged. This quickstart walks you through the simplest path to a pull request. You'll create a branch, make and commit changes, open a pull request, respond to feedback, and merge.

You can follow along on the GitHub website or with GitHub CLI by selecting one of the tabs above.

## Branch or fork the repository

You'll start by creating an isolated place to work.

<div class="ghd-tool webui">

1. On GitHub, navigate to the main page of the repository you want to propose changes for.
2. Optionally, if you don't have write access, you'll need a fork. Click **Fork** in the top-right corner and follow the steps. Then, continue in your fork of the repository.
3. Click the branch selector menu at the top of the file list. It probably says **main**. Type a new branch name and click **Create branch *new-branch-name* from main**.

</div>

<div class="ghd-tool cli"> 

1. To use GitHub CLI, you'll need to install it first. See [Démarrage rapide de l’interface CLI GitHub](/fr/enterprise-server@3.21/github-cli/github-cli/quickstart).

2. Clone the repository. Or, fork the repository and clone it locally at the same time.

* If you have write access to the repository, clone the repository:

  ```shell
  gh repo clone OWNER/REPO
  ```

* If you don't have write access, you'll create a **fork** first and clone it all at once.

  ```shell
  gh repo fork OWNER/REPO --clone
  ```

1. Change to the cloned repository directory.

   ```shell
   cd REPO
   ```

2. Create and switch to a new branch.

   ```shell
   git checkout -b YOUR-BRANCH-NAME
   ```

</div>

## Author or edit your code

Make your changes on the branch. For your first pull request, keep the change focused and simple. Smaller pull requests are faster to review and easier to merge.

Try one of the following to make your changes:

* Edit files locally in your IDE or a text editor.
* Edit a file directly on GitHub by browsing to it and clicking <svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-pencil" aria-label="Edit this file" role="img"><path d="M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.081-.286.235-.547.445-.758l8.61-8.61Zm.176 4.823L9.75 4.81l-6.286 6.287a.253.253 0 0 0-.064.108l-.558 1.953 1.953-.558a.253.253 0 0 0 .108-.064Zm1.238-3.763a.25.25 0 0 0-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 0 0 0-.354Z"></path></svg>.

## Commit frequently

Save your work in small, meaningful commits. Each commit records a snapshot and a message describing the change.

<div class="ghd-tool cli">

```shell
git add .
git commit -m "Describe your change"
git push --set-upstream origin YOUR-BRANCH-NAME
```

</div>

<div class="ghd-tool webui">

When you edit a file on GitHub and are ready to commit, you'll enter a commit message and commit directly to your branch.

1. Click **Commit changes...**.
2. In the **Commit message** box, enter a short description of the changes you made.
3. Select the branch you're working on.
4. Click **Propose changes**.

Your change will be added and committed to the branch.

</div>

## Open your pull request

When your branch has the changes you want to propose, open a pull request against the base branch.

<div class="ghd-tool webui">

1. On the main page of the repository, click **<svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-git-pull-request" aria-label="The pull request icon" role="img"><path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> Pull requests**, then click **New pull request**.
2. For the **base** branch, main is probably already selected and is typically the base branch you'll merge into.
3. For the **compare** branch, select the branch that contains your changes.
4. Click **Create pull request**.
5. Enter a title and a description that explains what you changed and why.
6. You can create a pull request that's ready to review or one that's in a draft state.

* If it's ready for review, click **Create pull request**.
* To share a work in progress, use the dropdown and select **Create draft pull request**.

</div>

<div class="ghd-tool cli">

You can create a pull request that's ready to review or one that's in a draft state.

* If it's ready for review:

  ```shell
  gh pr create
  ```

* To share a work in progress

  ```shell
  gh pr create --draft
  ```

Then, follow the prompts to set the base branch, title, and description.

</div>

If you make further commits to the same branch, they will be automatically added to your pull request.

## Request a review

To request a review via the **Reviewers** box, you need write access to the repository and you can request a review from a person or team with read access to the repository. If you request a review the person or team will receive a notification. In some cases, you'll see suggested reviewers that you can select from.

If the **Reviewers** box is unavailable to you, you can:

* Check the readme for the repository for their guidance on pull request reviews and follow their instructions.
* If you know a person who can do the review for you, reach out to them and share the link to your pull request.

## Address review feedback

Reviewers may comment, suggest changes, or request changes before a pull request can be merged.

* To accept a reviewer's suggestion, click **Commit suggestion** (or batch several and click **Commit suggestions**).
* To make broader changes, edit your code and push new commits to the same branch. The pull request updates automatically and will re-run any checks.
* Mark each conversation as **Resolved** once you've addressed it.

## Merge and deploy

Once required reviews and status checks pass, merge the pull request to bring your changes into the base branch. If you decide not to merge the changes, you can close the pull request instead.

> \[!TIP]
> Different repositories may have different requirements for merging. Review any relevant guidance and follow its instructions.

<div class="ghd-tool webui">

1. At the bottom of the pull request, click **Merge pull request**.
2. Click **Confirm** to complete the merge.
3. (Optional) Delete the head branch to keep the repository tidy.

</div>

<div class="ghd-tool cli">

```shell
gh pr merge
```

Follow the prompts to pick a merge method and optionally delete the branch.

</div>

## Next steps

After your first pull request, try reviewing someone else's work. See [Quickstart for reviewing pull requests](/fr/enterprise-server@3.21/pull-requests/get-started/reviewing-pull-requests-quickstart).

## Further reading

* [Writing code for a project](/fr/enterprise-server@3.21/pull-requests/concepts/writing-code-for-a-project)
* [Pull requests](/fr/enterprise-server@3.21/pull-requests/reference/pull-requests)