Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a branch from issue in GitLab

I've just started using GitLab, and have created a set of issues, in order to keep an overview of what needs to be done for my application. I was wondering if it was possible to create a branch from these issues, such that the branch and issues are linked, similar as in jira and Stash from atlassian?

like image 694
JonasN89 Avatar asked Apr 08 '17 14:04

JonasN89


People also ask

How do I create a branch of issue in GitHub?

Creating a branch for an issue On GitHub.com, navigate to the main page of the repository. Under your repository name, click Issues. In the list of issues, click the issue that you would like to create a branch for. In the right sidebar under "Development", click Create a branch.

How do I move a problem from one project to another in GitLab?

Moving an issue will close it and duplicate it on the specified project. There will also be a system note added to both issues indicating where it came from or went to. You can move an issue with the "Move issue" button at the bottom of the right-sidebar when viewing the issue.

How do I create a new branch in git branch?

Now choose your child branch as from branch and enter the name of your new branch. -> GrandChildBranch and so on. You can create any new branch from any existing branch, tag, commit, etc. Hope it will help.

How do I manually create a branch in Git?

To create a new Git branch in GitKraken, you will simply right-click on any branch or commit and select Create branch here . ProTip: GitKraken will automatically checkout the branch for you immediately after the branch has been created, so you can get straight to work on the right file.


2 Answers

If you create a branch with the name <issue-number>-issue-description and push that branch to gitlab, it will automatically be linked to that issue. For instance, if you have an issue with id 654 and you create a branch with name 654-some-feature and push it to gitlab, it will be linked to issue 654.

Gitlab will even ask you if you want to create a merge request and will automatically add Closes #654 to the merge request description which will close issue 654 when the merge request is accepted.

Also if you go to a given issue page on gitlab, you should see a New Branch button which will automatically create a branch with a name of the form <issue-number>-issue-description.

like image 128
Jawad Avatar answered Oct 08 '22 20:10

Jawad


On the Issue screen, you see a green button labeled "Create merge request", with a down-arrow to its right.

That's not a button, that's a drop down list of buttons.

  • Click on the down arrow
  • Choose "Create branch"
  • Click on "Create branch"
  • A branch is created from the issue number, plus the title of the branch
    • For example, my issue #2, with title "Test repoSearch with no repos" will have a branch called:
    • 2-test-reposearch-with-no-repos
    • Notice that it changes case to all-lower-case
like image 29
Robert Echlin Avatar answered Oct 08 '22 20:10

Robert Echlin