Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chmouel/gh-workon
A gh extension to create a branch out of issue
https://github.com/chmouel/gh-workon
command-line gh-extension git github shell
Last synced: 3 months ago
JSON representation
A gh extension to create a branch out of issue
- Host: GitHub
- URL: https://github.com/chmouel/gh-workon
- Owner: chmouel
- License: apache-2.0
- Created: 2022-11-08T06:39:07.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-16T08:30:16.000Z (10 months ago)
- Last Synced: 2024-07-28T17:35:32.148Z (3 months ago)
- Topics: command-line, gh-extension, git, github, shell
- Language: Shell
- Homepage:
- Size: 40 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gh-cli-extensions - **workon** - Create a branch or a commit message from an issue title and assign yourself to it. (Tool)
README
# gh-workon
Create a git branch from a GitHub issue and assign it to yourself.
## Demo
#### Simple
https://user-images.githubusercontent.com/98980/200496618-bbd935dd-e34e-4e06-936b-d35b212a6e83.mp4### Using worktree and selecting the branch from where to start
https://github.com/chmouel/gh-workon/assets/98980/d3fd47c2-5eab-41d1-b933-c985161a6506
## Installation
```shell
gh extension install chmouel/gh-workon
```### Requirements
- [GH](https://github.com/cli/cli)
- GNU sed
- GNU awk
- [FZF](https://github.com/junegunn/fzf)## Usage
gh workon extension let you choose an issue from a list of issues with FZF and
automatically create a branch out of it and assign the issue to yourself.If you specify a query as the first argument, it will be used to filter the list of title matching this query.
```shell
gh workon "crash"
```if you add a `-c` it will generate a commit message with the issue title and the issue number. You can automate the creation of the commit this like this :
```shell
git commit -m "$(gh workon -c)" --edit
```The `-N` flag will not create any branch and just print the one that would have been created.
When you have the `-F` it will use the issue number directly and not try to
choose any via fzf (useful if you have a old issue reaching the gh issue list
limit)You can specify the flag `-p` to prompt for a branch (with fzf) from where the new branch or worktree will start from.
You can specify a -w with a basedir as argument to have a worktree created in the basedir (with the issue name appended) and a new branch.
## Git hooks
If you install the script [prepare-commit-msg](./prepare-commit-msg) into your
`.git/hooks` directory (make sure it is set as executable). It will automatically
detect if you are in branch named `issue-NUMBER` and prepare a commit message out
of the issue title for you.It tries to do the right thing and only add the `Fixes #ISSUE_NUMBER` if there is already a commit message but that `Fixes` keywork is not there.
## TODO
- Support glab
- Create worktree instead of branch
- Convert it to go/rust/python to avoid shell quoting issues.## BUGS
- may be buggy with some characters due of shell quoting issues.
## Copyright
[Apache-2.0](./LICENSE)
## Authors
Chmouel Boudjnah
- Fediverse - <[@[email protected]](https://fosstodon.org/@chmouel)>
- Twitter - <[@chmouel](https://twitter.com/chmouel)>
- Blog - <[https://blog.chmouel.com](https://blog.chmouel.com)>