Drupal Gitlab Merge Request Workflow explained.

With the introduction of Merge Request workflow in Drupal Gitlab, It is now easier than ever to contribute to Drupal via code.

This article will explain the steps involved in this workflow. This article will even be more helpful to those who want to get started with code contribution. This is because now one requires very less technical setup on their local to start contribution.

If you wish to watch the workflow in action, I’ve created a video also for learning purpose attached below.

Let’s start.

Step 1: Find a Drupal.org issue OR Create one.

The first step is to pick an issue or if you intend to create one then go ahead. Next, keep the issue page open.

Step 2: Create Fork.

Once we know where and what to fix. We can then click the “Create Issue Fork” button in the issue queue and wait for the issue branch to get created. Once created. Click on the branch name. You will be redirected to Drupal Gitlab Interface.

Step 3: Make changes to the fork.

Browse the repository and make changes to all the respective files. Once done scroll down and add a commit message and create a commit to the issue target branch as shown below.

Step 4: Commit & Push changes to the issue fork branch.

Once the changes are merged into the issue branch. You should be able to see a Create Merge Request button on the GitLab interface. When submitting a merge request, make sure the source branch is your issue branch and the target branch should be the intended branch where this change should go.

Review the changes done and hit Submit Merge Request. Your merge request will look something like this.

Once the MR is submitted, the same is reflected in the Drupal.org issue.

If you add any comment to the MR, the same comment gets synced to the issue as well, so that no communication is lost during the reviews.

Mark the issue as Needs Review and let the reviewers and maintainers take this issue forward from here.

How a maintainer can merge a Merge Request?

Whenever a maintainer opens any issue for their projects. They should see a new select dropdown listing all the open Merge Requests for this current issue.

Select the desired MR to merge and click the “Merge” button on the right side to merge the code to the project.

Once the code is merged, a merge comment is created on the issue.

And… we are done.

Notice we just worked on our Browser to create simple contribution like this(watch the video shared above for the above steps in action). This workflow clearly reduces the tools required.

If you are a seasoned contributor and wants to commit & push code by the terminal, you can easily do it by doing the same things shared above but with your terminal. Goto the issue page and click “Show commands” to see all the git URLs for issue forks and the branch created.

Conclusion

I personally feel this was a very long-awaited requirement for the Drupal community. The community has been using the patch workflow ever since and now I feel it is good to have a development workflow similar to how rest of the world does it. This workflow in itself is unique. I liked the way how comments are synced across merge requests and Drupal.org issues.

This IMO will definitely increase Drupal adoption from new contributors and the ones who are outside of Drupal bubble. I see this as a very positive development and looking forward to actively use this for my projects.

Please feel free to Tweet me about any issues/feedback for this post.

#DrupalThanks

See you again!

I write #code, not sure about my articles !! ❤️s #Technology #Science #Music #Pets #Drupal … Profession: Senior Engineer at @qed42.