banner



How To Create Branch On Github

Problem, meet Solution 🤝 Solution, meet Problem.

The GitHub platform can be extended with Apps and Actions. You can find and install Apps on the GitHub Marketplace. An App that was built specifically to automate the process of creating branches for issues is Create Issue Branch.

Create Issue Branch on the GitHub Marketplace

Getting started with the App for your repositories is a matter of clicking on the "Set up free trial" button, select a plan (it's free for non-commercial use) and Install it for a selection (or all) of your repositories.

After Create Issue Branch is installed for a repository a new branch is created automatically if an issue is assigned:

A branch is created automatically after the issue is assigned

Support for different workflows

Development workflows vary between projects and teams.
This is why quite some configuration options have been added to the App since it launched 1,5 years ago. Below are some explained, you can find many more options in the documentation. The configuration is stored in a YAML file on the repository or organization level.

ChatOps mode

By default Create Issue Branch creates a new branch after an issue is assigned but you can also put the App in ChatOps-mode, where it only creates a branch if the ChatOps command /create-issue-branch (or just /cib) is given in an issue comment:

ChatOps mode: a branch is created after the ChatOps command is given

GitHub Action support

Installing the App can be done with the click of a button and gives you access to the workflow modes described above. If you want to tailor your development workflow even further Create Issue Branch can also be run as a GitHub action.

The workflow YAML below shows how Create Issue Branch can be embedded as a GitHub Action:

          on:
issues:
types: [ assigned ]
issue_comment:
types: [ created ]
pull_request:
types: [ closed ]

jobs:
create_issue_branch_job:
runs-on: ubuntu-latest
steps:
- name: Create Issue Branch
uses: robvanderleek/create-issue-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Custom branch names

How you like your branch names is a matter of taste or depends on the standard a team has decided upon.

Create Issue Branch offers a lot of configuration options to help you pick the branch name style that matches your preferences.
For example, you can have very short branch names, such as i123, slightly longer names, such as issue-123, stick with the default: issue-123-fix-sorting-by-price-bug, have branch names with prefixes based on issue labels: bug/issue-123-fix-sorting-by-price-bug, or just about any other style you can think of.

So, why isn't this feature in GitHub?

If creating issue branches is such a mundane but essential part of the Git development workflow, then why isn't this feature available in the GitHub issue interface? Especially since other platforms do support it (for example here in GitLab) and once you're used to the feature it's hard to work without.

I've created the Create Issue Branch App in response to a long-standing feature request issue. That issue has now been closed and followed up by an issue in the official GitHub account. Perhaps some day this feature will be included in GitHub Issues but until that day install Create Issue Branch and enjoy the little workflow improvement! 🚀

Happy coding!

How To Create Branch On Github

Source: https://levelup.gitconnected.com/automatically-create-a-branch-from-an-issue-in-github-fcfc50b1d68f

Posted by: shroyerplasoner.blogspot.com

0 Response to "How To Create Branch On Github"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel