A GitHub CLI extension that automatically prefixes branch names with your GitHub username when creating development branches from issues.
gh extension install razekmh/gh-develop-with-prefixIf you want to install from a local copy:
git clone https://github.com/razekmh/gh-develop-with-prefix.git
cd gh-develop-with-prefix
gh extension install .Use gh develop-with-prefix exactly like you would use gh issue develop, but with automatic username prefixing:
# Create a branch from issue #123
gh develop-with-prefix 123
# Create a branch with additional flags
gh develop-with-prefix --base main --checkout 456
# Use a custom prefix instead of your GitHub username
gh develop-with-prefix --prefix sc 123 # Creates: sc/123-issue-titleYou can now specify a custom prefix using the --prefix flag. This is useful for teams that prefer initials or other short identifiers:
# Using initials instead of full username
gh develop-with-prefix --prefix jd 42 # Creates: jd/42-issue-title
# Using team abbreviations
gh develop-with-prefix --prefix fe 123 # Creates: fe/123-issue-title (frontend team)If no --prefix is specified, it falls back to your GitHub username.
For convenience, this extension also provides shorter aliases:
# Short alias
gh dev-prefix 123
gh issue-dev-prefix 123All three commands (gh develop-with-prefix, gh dev-prefix, gh issue-dev-prefix) work identically.
When you run gh develop-with-prefix 123 on an issue titled "Add new feature":
- Standard gh issue develop: Creates branch
123-add-new-feature - With this extension: Creates branch
razekmh/123-add-new-feature
- GitHub CLI (
gh) installed and authenticated - The repository must have issues enabled
- You must have permission to create branches in the repository
- Retrieves your GitHub username using
gh api user - Fetches the issue title using
gh issue view - Generates a branch name in the format:
username/issue-number-issue-title - Calls
gh issue developwith the prefixed branch name
# Basic usage with GitHub username (all equivalent)
gh develop-with-prefix 42
gh dev-prefix 42
gh issue dev-prefix 42
# Using custom prefix
gh develop-with-prefix --prefix sc 42 # Creates: sc/42-issue-title
# With base branch and custom prefix
gh develop-with-prefix --prefix jd --base develop 42
# With checkout flag and custom prefix
gh develop-with-prefix --prefix fe --checkout 42
# Get help
gh develop-with-prefix --helpThe extension is a bash script that wraps the gh issue develop command. It:
- Parses command line arguments
- Extracts the issue number
- Fetches your GitHub username and the issue title
- Constructs a prefixed branch name
- Passes all arguments through to
gh issue develop
- Fork the repository: https://github.com/razekmh/gh-develop-with-prefix
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Test the extension locally:
gh extension install . - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature/your-feature - Submit a pull request
This extension is available on GitHub: https://github.com/razekmh/gh-develop-with-prefix
Browse the code, report issues, or contribute improvements!
MIT License - see LICENSE file for details.