Pull requests
Bob can generate pull requests (PRs) and PR descriptions directly from your IDE, streamlining your development workflow and saving time.
Why use this feature?
- Save time: Generate detailed PR descriptions automatically based on your changes.
- Maintain consistency: Ensure all PRs follow a consistent format.
- Improve collaboration: Provide clear context for reviewers with well-structured descriptions.
- Streamline workflow: Create PRs without leaving your IDE.
How it works
Bob analyzes your branch changes, commit history, and branch name to understand the purpose and scope of your work. It then generates a meaningful PR title and detailed description that summarizes your changes, making it easier for reviewers to understand the context and purpose of your PR. After generation, you can review and edit the PR description before submission.
The PR generation process is interactive, allowing you to select the target branch and remote repository before creating the PR.
Getting started
Prerequisites
- Your changes must be committed to a branch.
- You must have push access to the remote repository.
Basic usage
You can choose from 3 options to initiate a PR flow:
- Click the PR icon in the Source Control panel.
- Use the command palette (Cmd + Shift + P on Mac, Ctrl + Shift + P on Windows/Linux) and search for "Bob: Generate PR".
- Type
/create-prin the Bob chat interface.
Bob will then guide you through the following steps:
- Select the base branch you want to merge into. Bob will suggest the three most likely branches.
- Select the remote repository, if you have multiple remotes.
- Review the generated PR description and title.
- Create the PR.
- Get the newly created PR link in your chat.
Using templates for PR descriptions
Bob automatically detects and uses your project's existing PR templates when generating pull request descriptions. This ensures your PRs are consistent with your team's established standards. When Bob detects multiple PR templates in your project, you can select which template to apply to your pull request.
Template detection
Bob searches for PR templates in the following locations relative to your project root:
${cwd}/pull_request_template.md${cwd}/docs/pull_request_template.md${cwd}/.github/pull_request_template.md${cwd}/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md${cwd}/PULL_REQUEST_TEMPLATE/pull_request_template.md${cwd}/docs/PULL_REQUEST_TEMPLATE/pull_request_template.md
If Bob finds multiple templates, Bob will ask the user to choose which template to use for the PR description.
Default template
If no template is found in your project, Bob uses a built-in template that includes:
- A descriptive title derived from your branch name
- A summary of changes
- Key implementation details
- Testing information
- Any relevant links or references
Editing the generated description
After generating the PR description, you can choose to edit it before submission:
- When prompted, select whether you want to edit the description.
- If you choose to edit, Bob opens the description in a temporary markdown file.
- Make your desired changes to the description.
- Click the "Done" button when you have completed your edits.
If you choose not to edit, Bob uses the generated description as-is.
Customizing templates
For the best results with Bob's PR generation:
- Use clear section headings in your templates (e.g.,
## Summary,## Changes) - Include placeholder text that provides context (e.g.,
<!-- Describe the purpose of this PR -->) - Consider adding sections for testing instructions and related issues
Tips and best practices
- Use descriptive branch names to help Bob generate more accurate PR descriptions.
- Review and edit the generated description before creating the PR.
Commit messages
Bob can automatically generate meaningful commit messages based on your staged changes, saving you time and ensuring consistency in your commit history.
Enhance prompt
Improve your prompts before sending them to Bob. Click the sparkles icon in the chat input to automatically refine your request, making it clearer, more specific, and more likely to yield better results.