7 ms·
Git CLI tool for intelligently creating branch names
- pat_erichsen 1y agoNeat! Linear does this really well with a few different configurable patterns.
- ytreister 1y agoI am not sure how configurable the button in Linear is. Also, gibr allows a user to not need to even leave their terminal to list their issues and create/push the branch. I also hope to have more features like creating a PR/MR and linking to a git repo. Also many people do not have the luxury of using Linear, many companies force developers to use Jira...
- dcre 1y agoSounds similar to a short script I use to generate branch names with jj, which has the advantage that you don’t have to name a branch until after you’ve already written the code, so the LLM can name it based on the contents of the diff. https://crespo.business/posts/overeng-pr-create-jj/ https://crespo.business/posts/overeng-pr-create-jj/
- davelee 1y agoI use the `%f` format option. I have a `bn` alias ("branch name"): git show --no-patch --format=%f [<commit>]
- ytreister 1y agoInteresting idea, however, don't you first need to create the branch before you start committing commits?
- r1cka 1y agoI think people worry too much about branch names. Feature branches are usually ephemeral. Prefix your branch with your personal identifier so I know who is primary on it and worry more about the commit message which will live on indefinitely.
- morkalork 1y agoYes, please just name the branch after the ticket/issue number so we can all get the context for it and call it a day
- wara23arish 1y agoI hate issue numbers for branch names. ISSUE-9482 doesn’t really provide much. Ticket link should always be included in PR description. But branch names should be descriptive like terraform_dev_create_instance etc
- ytreister 1y agogibr makes it easy to do this and in a consistent manner
- 6LLvveMx2koXfwn 1y agowe do: [feature/bug]/ISSUE-NUMBER-summary-of-issue e.g.: bug/psi-456-broken-args-parsing
- darkwater 1y agoMore or less the same here, but we (I?) prefix it with the username as well, so when pulling branches you know who created it.
- celticninja 1y agoBut the PR and git blame can tell you this so I would never look at the Branch name to find out this information
- darkwater 1y agoFor me is useful when I run 'git fetch' from the command line. I don't use any graphical git client
- teiferer 1y agoI was so afraid that this is another "look I built sth that uses AI!" post, slopped together in an afternoon. I'm glad it's not, such a relief! This reaction tells me a lot about the state of our industry. (Or just the state of my mind.)
- ytreister 1y agoI used some AI to help me, but I put in a lot of thought to how it is created. I have plans to add many more useful features over time.
- roflchoppa 1y agoa format that as worked well for me (and that I've brought with me to other teams) ``` issues/{username}/{issue-number}-{description} ``` The username prefix is helpful, for both organization, and locating branches.
- ytreister 1y agoUnfortunately, gibr does not yet support username in the branch name, but I created an issue and hopefully can get it done very soon https://github.com/ytreister/gibr/issues/42 https://github.com/ytreister/gibr/issues/42
- ytreister 1y agoI implemented this in version 0.6.0 which was just released. https://github.com/ytreister/gibr/releases/tag/0.6.0 https://github.com/ytreister/gibr/releases/tag/0.6.0 The issue assignee can be used in the branch name. In the future I want to allow a user to easily assign an issue to the current user if they use gibr with an unassigned issue
- compilethread 1y agoSimple and clear branch names make teamwork so much easier.
- ytreister 1y agoYes, I agree, and that is why I created this tool
- spencera 1y agoI think in 2025 "intelligently creating" kind of implies the use of AI but (thankfully) this is just doing a string format based on an issue title.
- ytreister 1y agoI don't know why I did not think of that, but I can see how people would assume this nowadays!
- celticninja 1y agoI think branch names are quite unimportant in development and often don't worry about them being too descriptive. In my org it is common to use the JIRA ticket number in there somewhere but other than that I think you should leave it up to devs. I can't think of a reason why I would need to know the branch name. My favorite branch name I created was for a JIRA ticket with the number 2468. This became ab-2468-who-do-we-appreciate Detailed branch naming conventions are just another piece of useless documentation for devs. And if you are using the branch name to tell you what is going on the you are misunderstanding the review process.
- ytreister 1y agoWhen you use Gitlab and squash your merge request, a new merge commit with the name of the branch is created, so I found it very helpful in that situation to know the name of the branch.
- paradox460 1y agoI rarely make named branches these days. Just use JJ git push -c, which creates a branch name based off the change I'm pushing
- ytreister 1y agoInteresting. That seems to work if your work is not associated with an issue tracker. Many use issue trackers and like to link each branch or PR/MR to an issue tracker.
- paradox460 1y agoWe've done the same thing, but we only link JIRA tickets to PRs, so when I open a PR, I stick it in the PR description body.
- ytreister 1y agoOK, so it is possible that when the gibr pr command gets added that it could be helpful. My thought is for it to automate the creation of the PR and will contain the description which links to the Jira issue. I have not gotten there yet though
- paradox460 1y agoI was doing that for a while with some CLI scripts, never really melded them together, but I had one from before I started using JJ that would make a new git branch named off a JIRA ticket, and a newer one that wrapped up the various jj and github gh cli invocations to create a PR off a branch. The jira cli util I used, go-jira, hasn't been updated to use the new Atlassian APIs, and I haven't spent too much time looking for a replacement. https://github.com/paradox460/dotfiles/blob/main/dot_bin/executable_jjpr https://github.com/paradox460/dotfiles/blob/main/dot_bin/exe... - This creates PRs based off a few different approaches, the -c flag lets you do nameless branches https://github.com/paradox460/dotfiles/blob/main/dot_bin/executable_gnb https://github.com/paradox460/dotfiles/blob/main/dot_bin/exe... - is the one that would fetch tickets from JIRA and make new branches off of it
- ytreister 1y agoHey everyone — I’m actually the author of gibr! I just wanted to say thanks for all the comments and discussion. It’s been amazing (and honestly a bit surprising) to see so many developers checking it out. The idea for gibr came from the frustration I had when I was forced to use Jira for issue tracking and GitLab for our repos. At the time, I built an internal tool called jig that integrated the two. With a single command, it could create a branch, push it, transition the Jira issue to In Progress, and open a merge request with everything pre-filled — assignee, reviewers, description, and so on. It became really popular at my company. I decided to take that idea further and rebuild it as an open-source tool with a plugin architecture, so it could work with any issue tracker or Git provider, not just Jira and GitLab. If anyone has feedback or ideas for new integrations, I’d love to hear them — some great suggestions have already come in that might make it into the next release. Thanks again for the support — this community is awesome.