GitLab can be able to refer the specific issue from the commit message to solve a specific problem. In this chapter, we will discuss about how to reference a issue in the GitLab −
Step 1 − To reference a issue, you need to have an issue number of a created issue. To create an issue, refer the creating issue chapter.
Step 2 − To see the created issue, click on the List option under Issues tab −
Step 3 − Before making the changes in your local repository, check whether it is up to date or not by using the below command −
git checkout master && git pull
The git pull command downloads the latest changes from the remote server and integrates directly into current working files.
Step 4 − Now, create a new branch with the name issue-fix by using the git checkout command −
git checkout -b issue-fix
Step 5 − Now, add some content to the README.md file to fix the bug −
echo "fix this bug" >> README.md
Step 6 − Enter the commit message for the above change with the below command −
git commit -a
This command opens the below screen and press Insert key on the keyboard to add a commit message for the issue-fix branch.
Now press the Esc key, then colon(:) and type wq to save and exit from the screen.
Step 7 − Now push the branch to remote repository by using the below command −
git push origin issue-fix
Step 8 − Login to your GitLab account and create a new merge request. You can refer the merge request chapter for the creation of merge request.
Step 9 − Once you create the merge request, you will be redirected to the merge request page. When you click on the Close merge request button (refer the screenshot in the step (6) of merge request chapter), you will see the Closed option after closing merge request.