Skip to content

rm3l/gh-dev-branch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gh-dev-branch

Build Lint CodeQL Analysis Go Report Card

GitHub CLI extension to generate meaningful branch names off of issues.

This is a simple extension that helps generate meaningful names for branches as soon as you want to start working on a given issue.

Think of it as the CLI counterpart for the beta feature of development branches that can be created in the GitHub UI, as documented here: https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-a-branch-for-an-issue

Installation

gh extension install rm3l/gh-dev-branch

Usage

❯ gh dev-branch -h

Usage: gh dev-branch <issue> [options]
Options:
  -max-length int
        max length of generated branch name (default -1)
  -repo string
        repository to use for finding the issue

Examples

# Using the current directory. Base repo is determined from the current Git repository
❯ gh dev-branch 294
294-could-not-find-unspecified-when-importing-transitive-dependencies

# or you can use the result in other commands, like to create and switch to that new branch
❯ git switch -c `gh dev-branch 294`     
Switched to a new branch '294-could-not-find-unspecified-when-importing-transitive-dependencies'

Or

# Using an issue from any other GitHub repo
❯ gh dev-branch 9792 -repo openwrt/openwrt
9792-feature-request-deterministic-configuration-export

Working with the source code

  1. Clone the repository:
git clone https://github.com/rm3l/gh-dev-branch
cd gh-dev-branch
  1. Download and install Go to build the project. Or if you are already using the asdf version manager, you can just run asdf install to install all the necessary tools (declared in the .tool-versions file).

  2. Install the local version of this extension; gh symlinks to your local source code directory.

# Install the local version
gh extension install .
  1. At this point, you can start using it:
gh dev-branch <my-issue-number> [-repo <my_org/my_repo>]
  1. To see changes in the code as you develop, simply build and use the extension
go build && gh dev-branch <my-issue-number> [-repo <my_org/my_repo>]

Contribution Guidelines

Contributions and issue reporting are more than welcome. So to help out, do feel free to fork this repo and open up a pull request. I'll review and merge your changes as quickly as possible.

You can use GitHub issues to report bugs. However, please make sure your description is clear enough and has sufficient instructions to be able to reproduce the issue.

Developed by

License

The MIT License (MIT)

Copyright (c) 2022-2023 Armel Soro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.