Skip to content

razekmh/gh-develop-with-prefix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

gh-develop-with-prefix

A GitHub CLI extension that automatically prefixes branch names with your GitHub username when creating development branches from issues.

Installation

Install from GitHub

gh extension install razekmh/gh-develop-with-prefix

Install from source

If 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 .

Usage

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-title

Custom Prefix Option

You 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.

Shorter Aliases

For convenience, this extension also provides shorter aliases:

# Short alias
gh dev-prefix 123
gh issue-dev-prefix 123

All three commands (gh develop-with-prefix, gh dev-prefix, gh issue-dev-prefix) work identically.

What it does

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

Requirements

  • GitHub CLI (gh) installed and authenticated
  • The repository must have issues enabled
  • You must have permission to create branches in the repository

How it works

  1. Retrieves your GitHub username using gh api user
  2. Fetches the issue title using gh issue view
  3. Generates a branch name in the format: username/issue-number-issue-title
  4. Calls gh issue develop with the prefixed branch name

Examples

# 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 --help

Development

The 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

Contributing

  1. Fork the repository: https://github.com/razekmh/gh-develop-with-prefix
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make your changes
  4. Test the extension locally: gh extension install .
  5. Commit your changes: git commit -am 'Add some feature'
  6. Push to the branch: git push origin feature/your-feature
  7. Submit a pull request

Repository

This extension is available on GitHub: https://github.com/razekmh/gh-develop-with-prefix

Browse the code, report issues, or contribute improvements!

License

MIT License - see LICENSE file for details.

About

No description or website provided.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages