Skip to content

Instantly share code, notes, and snippets.

@lakrizz
Created August 31, 2024 19:15
Show Gist options
  • Save lakrizz/7f137029dc85bcde3da4cf40703dacb5 to your computer and use it in GitHub Desktop.
Save lakrizz/7f137029dc85bcde3da4cf40703dacb5 to your computer and use it in GitHub Desktop.
gh cli / fzf - select an issue and this script automatically creates a branch linked to the issue and checks it out, put this in your `.<shell>rc`
alias gcib="repo=\$(basename \$(git rev-parse --show-toplevel)) && remote_url=\$(git config --get remote.origin.url) && [[ \$remote_url =~ github\.com[:/] ]] && repo_path=\${remote_url##*github.com[:/]} && issue=\$(gh issue list --repo \${repo_path%.git} --limit 100 --json number,title --template '{{range .}}{{.number}}: {{.title}}{{\"\n\"}}{{end}}' | fzf) && [[ -n \$issue ]] && gh issue develop \$(echo \$issue | cut -d: -f1) --repo \${repo_path%.git} --checkout"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment