Creating and managing pull requests in Visual Studio Code

Sara Verdi
Sara Verdi
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


With Visual Studio Code (VS Code), you can easily create and manage pull requests. This guide will walk you through how to create a pull request, highlighting how to leverage the GitHub integration and the Graphite VS Code extension to streamline your process.

Before diving into creating pull requests, make sure you have the following:

  • Visual Studio Code installed on your machine.
  • The GitHub repository cloned to your local machine.
  • The Graphite VS Code extension installed for enhanced pull request management.

You can install the Graphite extension by searching for "Graphite" in the Extensions view (Ctrl+Shift+X) in VS Code.

A pull request (PR) is a request to merge code changes from one branch to another within a repository. It allows team members to review code, discuss changes, and ensure quality before integrating updates into the main codebase.

To create a pull request in VS Code, follow these steps:

  1. Open the terminal in VS Code (Ctrl+`).

  2. Navigate to your project directory.

  3. Create a new branch using the following command:

    Terminal
    git checkout -b feature/my-feature

    Replace feature/my-feature with a descriptive name for your branch.

  1. Modify the files as needed for your feature or bug fix.

  2. Stage your changes by running:

    Terminal
    git add .
  3. Commit your changes with a meaningful message:

    Terminal
    git commit -m "Add new feature"

After committing your changes, push the branch to your GitHub repository:

Terminal
git push origin feature/my-feature

Now that your branch is pushed, you can create a pull request. Here’s how to raise a pull request in Visual Studio Code:

  1. Open the Source Control view (Ctrl+Shift+G).
  2. Click on the ellipsis (...) in the upper right corner of the Source Control panel.
  3. Select "Create Pull Request" from the dropdown menu. If you are using the Graphite extension, this option may be prominently displayed.
  4. Fill in the required fields, including the title and description for your pull request.
  5. Choose the base branch you want to merge into (typically main or develop).
  6. Click "Create Pull Request".

Once you’ve created a pull request, managing it is just as important. Here’s how to do that effectively:

  1. Open the Pull Requests panel by clicking on the GitHub icon in the Activity Bar.
  2. Select the pull request you want to review.

You’ll see details such as the code changes, comments, and the ability to approve or request changes.

You can add comments directly on the pull request to facilitate discussions:

  • To comment on a specific line, hover over the line in the "Files changed" tab and click the "+" icon.
  • Type your comment and submit it.

To merge a pull request:

  1. Navigate to the pull request you wish to merge.
  2. Click the "Merge" button once reviews are complete.
  3. Confirm the merge action.

The Graphite VS Code extension provides a user-friendly interface for viewing and managing PRs directly in VS Code. With the Graphite extension, you can:

  • Visualize and manage your stacks within your IDE
  • Create new branches
  • Modify existing branches
  • Submit pull requests
  • Sync your trunk branch
  • Get first-class support for stacking

Creating and managing pull requests in Visual Studio Code, as well as leveraging Graphite, can make your development process more efficient. By handling these tasks directly within VS Code—whether you're learning to create pull requests on GitHub or looking to enhance your practices—you can manage code changes more effectively.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2