Gitlab 简明教程

GitLab - Referencing Issues

GitLab 可从提交信息中撷取特定问题,以解决特定问题。在本章节中,我们将探讨如何参考 GitLab 中的问题 -

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 - 要参考问题,您需要一个已建立问题的问题编号。若要建立问题,请参考 creating issue

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 - 要查看已建立问题,请点击“问题”选项卡内的“列出”选项 -

Step 2 − To see the created issue, click on the List option under Issues tab −

reference issue 1

Step 3 - 在本地储存库中进行更动之前,请先使用下列命令,检查它是否是最新的 -

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
reference issue 2

git pull 命令可从远程服务器下载最新更动,并直接整合至当前工作档案中。

The git pull command downloads the latest changes from the remote server and integrates directly into current working files.

Step 4 - 现在,请使用 git checkout 命令建立一个名为 issue-fix 的新分支 -

Step 4 − Now, create a new branch with the name issue-fix by using the git checkout command −

git checkout -b issue-fix
reference issue 3

Step 5 - 现在,于 README.md 档案中添加一些内容以修正 bug -

Step 5 − Now, add some content to the README.md file to fix the bug −

echo "fix this bug" >> README.md

Step 6 - 使用下列命令输入上述更动的提交信息 -

Step 6 − Enter the commit message for the above change with the below command −

git commit -a

此命令将开启以下画面,请按下键盘上的 Insert 键,为 issue-fix 分支添加提交信息。

This command opens the below screen and press Insert key on the keyboard to add a commit message for the issue-fix branch.

reference issue 4

现在按 Esc 键,然后输入冒号 (:) 并键入 wq 来保存和退出屏幕。

Now press the Esc key, then colon(:) and type wq to save and exit from the screen.

Step 7 − 现在,通过使用以下命令将其分支推送到远程存储库:

Step 7 − Now push the branch to remote repository by using the below command −

git push origin issue-fix
reference issue 5

Step 8 − 登录 GitLab 帐户并创建一个新的合并请求。您可以参阅 merge request 章节以创建合并请求。

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 − 创建合并请求后,您将被重定向到合并请求页面。当单击“关闭合并请求”按钮(参考 merge request 章节中的步骤 (6) 中的屏幕截图)时,将在关闭合并请求后看到“关闭”选项。

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.

reference issue 6