Create a git branch from a GitHub issue and assign it to yourself.
Demo.git.workon.mp4
worktree-and-pickup.mp4
gh extension install chmouel/gh-workon
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.
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 :
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.
If you install the script 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.
- Support glab
- Create worktree instead of branch
- Convert it to go/rust/python to avoid shell quoting issues.
- may be buggy with some characters due of shell quoting issues.
Chmouel Boudjnah
- Fediverse - <@chmouel@chmouel.com>
- Twitter - <@chmouel>
- Blog - <https://blog.chmouel.com>