Graphite Reviewer is now Diamond

How to use pull request search based on branches in GitHub

Sara Verdi
Sara Verdi
Graphite software engineer
Try Graphite


Note

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


Searching for pull requests (PRs) based on branch information is an important skill for developers working with version control systems like Git on platforms such as GitHub. This guide covers techniques to efficiently search PRs using branch details, find PRs associated with specific commits, and integrate tools like Graphite CLI for enhanced productivity.

When working with GitHub, you might need to locate PRs that have been initiated from specific branches. This can be essential for managing large projects with many contributors and branches. Here's how you can do it:

  1. Access the Pull Requests tab in your GitHub repository.
  2. Use the filter bar: Enter base:branch_name to filter PRs by the base branch. For instance, if you want to see PRs that are based on the develop branch, you would enter base:develop.

screenshot of search filter

This method allows you to quickly filter and find PRs that are based on a particular branch, helping you manage merges and reviews more efficiently.

Sometimes, you might need to backtrack from a commit to the PR that introduced it, especially when debugging or understanding the context of changes. GitHub allows you to find PRs associated with specific commits:

  1. Navigate to the commit: Go to the "Commits" section of your repository. screenshot of commit section
  2. Access commit details: Click on the specific commit you're interested in. screenshot of commit section
  3. Locate the PR: If the commit is associated with a PR, GitHub will display a link to the PR right within the commit details. This link typically appears as #PR_number.

This functionality is helpful for tracing changes back to their source PR, providing insights into why changes were made.

Graphite offers a convenient keyboard shortcut, cmd+k, that simplifies searching for PRs without leaving your keyboard. This shortcut is particularly useful for developers working with multiple PRs, allowing for quick navigation and management directly from the interface.

  • Open your Graphite interface.
  • Press cmd+k: This opens a search bar.
  • Type your search terms: Input PR numbers, titles, or other relevant information to quickly locate the PRs you need.
  • Using this shortcut, you can efficiently manage your PRs, making it easier to handle feedback and integrate changes seamlessly.

screenshot of command+k window

Searching for PRs based on branch information or specific commits in GitHub is a powerful way to manage your development workflow. Integrating tools like Graphite and its PR search function further enhances this process, making it easier to manage complex PR structures and maintain a clean and efficient workflow. By mastering these techniques, developers can ensure better organization and traceability of changes across large and complex projects.

Git inspired
Graphite's CLI and VS Code extension make working with Git effortless.
Learn more

Built for the world's fastest engineering teams, now available for everyone