Merged
Conversation
- Auto-detect remote tracking branch instead of local branch name - Strip remote prefix (e.g., `m/rw/ws3` → `rw/ws3`) for GitHub PR head - Supports user-namespaced branches (e.g., `rw/` prefix) - Falls back to local branch name if no remote tracking branch Fixes issue where local branch `ws3` pushed to remote as `m/rw/ws3` would fail PR creation with "Head ref must be a branch" error.
- Go up one level from current directory - Use `git rev-parse --show-toplevel` to find repo root (instead of manual directory walking) - Properly detects parent repo from `gh/new/` nested git repos Fixes head branch auto-detection from `gh/new/` subdirectories.
- Default (no flag): Open web editor during creation (interactive mode) - `-y` once: Skip web editor, create then open result for viewing - `-y -y` or `-yy`: Skip all, create silently without opening Replaces previous `-w/--web` boolean flag with more flexible count-based approach. Updates all tests to use `yes=2` (create silently) instead of `web=False`.
**Bug 1: Title not stripped** - `read_description_file()` now strips placeholder prefixes like `[owner/repo#XXXX]` or `[owner/repo#NUMBER]` from titles - Prevents double-prefixing like `# [owner/repo#1967] [owner/repo#XXXX] Title` **Bug 2: Placeholder link definitions not removed** - `write_description_with_link_ref()` now removes placeholder link definitions (e.g., `[owner/repo#XXXX]:`) before adding the real one - Cleans up leftover placeholders from template Fixes issues where `ghpr create` would mangle titles and leave unused link definitions.
**New behavior:** - Creates DESCRIPTION.md with proper link-ref template (including `[owner/repo#XXXX]` placeholder) - Makes initial git commit - Creates public gist and adds as 'g' remote - Sets up main branch to track g/main - Force pushes to replace gist's orphan commit with local history **Benefits:** - Complete setup in one command - No orphan gist commits requiring force push - Gist ready to use immediately with `ghpr push` **Next steps** (shown to user): - `cd gh/new` - Edit DESCRIPTION.md - `git commit -am 'Update PR description'` - `ghpr create`
- Templates now use plain `# Title` format (no placeholders) - `create` reads plain format, creates PR/Issue, then updates file with link-reference format - Web editor mode waits for user to press Enter, then fetches PR info - `read_description_file()` now has `expect_plain` flag for pre/post-creation formats - Backward compatible: still handles old placeholder format when reading existing files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR includes several improvements to the
createandinitcommands, making the PR/Issue creation workflow more robust and user-friendly.Key Changes
Template and Workflow
# Titleformat; link-references added automatically after PR/Issue creationcreateCommand Improvementsws3→ remotem/rw/ws3)git rev-parse --show-toplevelto properly find parent repo when running from nestedgh/new/directory-y/--yescount flag:-yonce: Creates PR then views result-yytwice: Creates silently without openinginitCommand Improvements[owner/repo#XXXX]placeholders to confuse usersCommits
createto use remote branch name for PRscreateto use git to find parent repo root-y/--yescount flag to control opening behavior increatecreateinitcreate initial commit and set up gist mirror