Add flags to `gh pr create` to skip interactive prompts for push destination, template selection, body, and submission
- Dominant language
- Go
- Stars
- 46.3k
- Forks
- 9k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 89
Description
### Describe the feature or problem you'd like to solve
When using `gh pr create --title='my test pr'`, users still face 4 interactive prompts that require manual input:
1. **Push destination**: "Where should we push the 'test' branch?"
2. **Template selection**: "Choose a template"
3. **Body input**: "Body [(e) to launch nano, enter to skip]"
4. **Submission method**: "What's next?"
For users who consistently choose the first/default option in these prompts, this creates friction by requiring 4 manual interactions (pressing Enter) even when the desired outcome is predictable.
### Proposed solution
Add the following flags to automatically handle these prompts without user interaction:
- `--submit` - Automatically select "Submit" (complements the existing `--draft` flag)
- `--skip-body` - Skip the body input prompt entirely (different from `--body ""` which creates a PR with empty description)
- `--remote=` - Specify which remote to push to (e.g., `--remote=origin`)
- `--template=` - Specify template file (e.g., `--template=pull_request_template.md`)
**Example usage:**
```bash
gh pr create --title='my test pr' --submit --skip-body --remote=origin --template=pull_request_template.md
```
This would benefit CLI and its users by:
- **Eliminating repetitive interactions** for users with consistent workflows
- **Enabling efficient aliases** - users can set up aliases with their preferred flags and forget about the complexity
- **Maintaining consistency** with existing patterns (like `--draft` for drafts, now `--submit` for immediate submission)
- **Preserving flexibility** - users who want prompts can continue using the current behavior
### Additional context
The distinction between `--body ""` and `--skip-body` is important: the former creates a PR with an empty description, while the latter would skip the body prompt entirely (potentially using template content or leaving it truly empty).
Once users set up an alias like `alias ghpr="gh pr create --submit --skip-body --remote=origin --template=pull_request_template.md"`, they can forget about the flag complexity since they consistently choose the same options anyway.
Contributor guide
Assessment
This issue has not been assessed yet.