Create a draft pull request for the current branch.
Steps
- •
Get the current branch name:
codegit branch --show-current
- •
Check for uncommitted changes:
codegit status --porcelain
If there are uncommitted changes (modified, added, or untracked files): a. Run the project's formatter/linter if applicable (check CLAUDE.md or docs/index.md for commands) b. Stage all changes:
git add -Ac. Create a commit with a descriptive message based on the changes d. Use conventional commit format (feat:, fix:, docs:, refactor:, test:, chore:) - •
Check if the branch has an upstream:
codegit status -sb
- •If no upstream:
git push -u origin <branch> - •If upstream exists:
git push
- •If no upstream:
- •
Determine the base branch. Check in order:
- •
mainbranch exists? Usemain - •
masterbranch exists? Usemaster - •Fall back to the repo's default branch:
gh repo view --json defaultBranchRef -q .defaultBranchRef.name
- •
- •
Gather context — commits unique to this branch:
codegit log <base>..HEAD --oneline
- •
Create a draft PR:
codegh pr create --draft --base <base>
- •Title: descriptive of what the branch accomplishes
- •Body: summarize ALL changes based on the commits
- •
Return the PR URL to the user.
Important
- •Commit ALL uncommitted changes before pushing — don't leave anything behind
- •Do NOT use
--no-verifywhen pushing — let git hooks run - •If the linter/formatter finds issues, fix them before committing