How to target specific branch on GitHub issue
Asked Answered
C

2

4

I'm wondering if it's possible to target Issues to specific branches of a repo.

Use case:

I've a repo which have 1 main branch, and 2 development branches, A and B.

From branches A and B other branches grow, depending of the issues.

I'm already aware that is possible to reference a commit to issues via '#' keyword and the number of the issue, but I want it inverted, so the person that is creating the issue, can say something like:

"There's a bug in development branch A" or "There's a bug in @repoName/A" and that A or "@reponame/A" become a link to the branch in the same issue.

So my question is:

It's possible?

Already exists but I don't know the keyword for that?

I've to know the SHA of the current last commit of the branch?

Chela answered 18/11, 2020 at 17:24 Comment(3)
Issues are associated with a repository, not with any particular branch, tag, commit, or other reference. The solution you've mentioned -- tagging the reference in question in the issue description or comments -- is the way to go.Sofer
@Sofer thanks for your feedback! How can I tag the branch? cause "@" keyword is only useful for users and teams and "#" for referencing other issues :(Chela
Does this answer your question? How to associate GitHub issues with a branch?Udele
P
1

You could link to the GitHub permalink for this branch:

https://github.com/$group/$project/tree/$branchname

for instance, for the upcoming Git version: https://github.com/git/git/tree/next

But it is easier to just write "this affects $branchname". Anybody working on the project, has it locally anyway and can simply switch branches. Also, most of the time, branches have meaningful names (1.x, stable, dev, feature-X, …) so only mentioning the name is usually enough.

If you are specifically addressing a single commit, write the full commit hash in the issue description and GitHub will automatically create a link for it.

Perplexed answered 18/11, 2020 at 17:35 Comment(0)
R
5

but I want it inverted, so the person that is creating the issue, can say something like:

"There's a bug in development branch A"

Since Sept. 2022, you now have:

Link existing branches to an issue

In the Development section of an issue, you can now link existing branches (or pull requests) to that issue.
Learn more about manually linking branches to an issue.

https://static.mcmap.net/file/mcmap/ZG-AbGLDKwfpLC21bC2jaRA/user-images.githubusercontent.com/3369400/188875100-ca7ba34c-581e-40c9-9304-adf0f39408f0.gif?ssl=1

jzadra adds in the comments:

When creating a new issue there are no branches showing under development, and no gear icon for it.

However once you create the issue, you will then have the option to link it to a branch as shown above.

Rhizocarpous answered 7/9, 2022 at 22:11 Comment(2)
For those wondering, when creating a new issue there are no branches showing under development, and no gear icon for it. However once you create the issue, you will then have the option to link it to a branch as shown above.Quarterhour
@Quarterhour Thank you for the feedback. I have included your comment in the answer for more visibility.Rhizocarpous
P
1

You could link to the GitHub permalink for this branch:

https://github.com/$group/$project/tree/$branchname

for instance, for the upcoming Git version: https://github.com/git/git/tree/next

But it is easier to just write "this affects $branchname". Anybody working on the project, has it locally anyway and can simply switch branches. Also, most of the time, branches have meaningful names (1.x, stable, dev, feature-X, …) so only mentioning the name is usually enough.

If you are specifically addressing a single commit, write the full commit hash in the issue description and GitHub will automatically create a link for it.

Perplexed answered 18/11, 2020 at 17:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.