Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I merge a branch without closing the issue in Gitlab?

Tags:

git

gitlab

I'm using Gitlab.

I created an issue and then used the "create branch" button in the issue view page.

I worked on the branch and completed and committed around 80% of work.

When I created a merge request from this branch to master and accepted it, the issue was closed automatically.

What was I supposed to do to accept the merge request without closing the issue?

Or maybe it's a git concept that you should merge a branch only when the issue is complete resolved?

like image 258
Wit Avatar asked Jul 05 '17 05:07

Wit


People also ask

Does a branch disappear after merge?

There's no problem in deleting branches that have been merged in. All the commits are still available in the history, and even in the GitHub interface, they will still show up (see, e.g., this PR which refers to a fork that I've deleted after the PR got accepted).

What happens when you close a merge request in GitLab?

In Gitlab, the merged status means the relevant commits have been merged and no action is needed. A closed merge request is one that has been put aside or considered irrelevant. It is therefore not merged into the code base.

What happens when branches merge?

Merging Branches. Once you've completed work on your branch, it is time to merge it into the main branch. Merging takes your branch changes and implements them into the main branch. Depending on the commit history, Git performs merges two ways: fast-forward and three-way merge.


1 Answers

Gitlab analyses the commit messages of all commits on the default branch, which is most of the time the master branch.

If it detects an issue pattern, e.g. fixed #<issue number>, in a commit message, it will close this issue. Git handles also merges with commits, to be more specific by default it will create a merge commit.

Now to the merge request:

If you create a merge request in Gitlab from such kind of specific issue branch, it will automatically fill the commit message with a reference to the source issue. To prevent this you have to delete the commit message before merging.

Merge Request Approval

See the link on the right side which reads Modify Commit Message, there you will find the pattern.

like image 183
secustor Avatar answered Oct 18 '22 01:10

secustor