brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: gh issue develop creates a branch that GitHub links to the issue

Git
~/tips/tip-github-issue-develop-branch

gh issue develop 123 --checkout

Creates a branch for an issue on GitHub, linked to the issue, and can check it out locally.

Branch names for issues are usually typed by hand, and the link between the issue and the work only exists if someone mentions the number somewhere. gh issue develop asks GitHub to create a linked branch for the issue instead.

gh issue develop 123 --checkout

The help text describes the command as managing linked branches for an issue. With --checkout the new branch is checked out right after it is created. Some other flags from the same help page:

  • -n, --name sets the name of the branch to create.
  • -b, --base names the remote branch to create the new one from.
  • -l, --list lists the linked branches of an issue.
  • --branch-repo creates the branch in another repository, for example your fork.

For example, to see which branches are already linked to issue 123:

gh issue develop --list 123

And to start from a feature branch instead of the default branch:

gh issue develop 123 --base my-feature

When you use --base, the help says the new branch is configured as the base branch for pull requests created later with gh pr create.

Caveats. You need a logged-in gh, and the issue number has to come from the repository you are in, unless you add --repo owner/name. I have not run these commands against a live repository for this tip; the details come from the built-in help and the manual.

Further reading: gh issue develop manual

Going deeper: Moving on from hdtv: how to export your TV show list to Trakt.tv

More Git tips git show-branch main feature git log --stat -5 git merge --no-ff feature -m "Merge feature" git merge --squash feature git merge --abort All Git tips (144) All topics

Link