Create a PR
Create a pull request for the current branch against main.
Workflow
Follow these steps:
1. Understand the Conventional Commits syntax
The commit contains the following structural elements, to communicate intent to the consumers of your library:
- •fix: a commit of the type
fixpatches a bug in your codebase (this correlates withPATCHin Semantic Versioning). - •feat: a commit of the type
featintroduces a new feature to the codebase (this correlates withMINORin Semantic Versioning). - •BREAKING CHANGE: a commit that has a footer
BREAKING CHANGE:, or appends a!after the type/scope, introduces a breaking API change
(correlating withMAJORin Semantic Versioning). A BREAKING CHANGE can be part of commits of any type. - •types other than
fix:andfeat:are allowed, e.g.build:,chore:,ci:,docs:,style:,refactor:,perf:,test:, and others. - •footers other than
BREAKING CHANGE: <description>may be provided and follow a convention similar to the git trailer format.
Additional types are not mandated by the Conventional Commits specification, and have no implicit effect in Semantic Versioning (unless they include a BREAKING CHANGE).
A scope may be provided to a commit's type, to provide additional contextual information and is contained within parenthesis, e.g., feat(parser): add ability to parse arrays.
2. Understand the PR contents
Run in parallel:
- •
git statusto see untracked files (never use -uall flag) - •
git diffto see staged and unstaged changes - •Check if the current branch tracks a remote branch and is up to date
- •
git log --oneline main..HEADandgit diff main...HEADto understand all commits on this branch
If there are uncommitted changes, warn the user before proceeding.
3. Draft a PR title and body
Analyze ALL commits on the branch (not just the latest) and draft
- •A short PR title (under 70 characters) using Conventional Commits syntax:
<type>[optional scope]: <description> - •A PR body summarizing the changes made in the PR. Use bullet points.
Afterwards, ask for feedback regarding the title and body.
4. Create the PR
Push the branch if needed, then create the PR using:
gh pr create --title "<type>[optional scope]: <description>" --body "$(cat <<'EOF' <bullet points> EOF )"