nopAccelerate

Faster, scalable and reliable nopCommerce.

How to Merge Branches in GitLab Using TortoiseGit: A Step-by-Step Guide

FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail
Step-by-step guide to merging branches in GitLab using TortoiseGit

Learning how to merge branches in GitLab is essential for developers and DevOps engineers who want smooth collaboration and reliable code history. Version control is a cornerstone of modern software development, and GitLab, a popular Git repository manager, offers powerful tools for managing branches and workflows. For those who prefer graphical interfaces over command-line Git, TortoiseGit provides an intuitive Windows shell extension to perform Git operations visually.

This step-by-step guide walks you through the complete process of merging branches in GitLab using TortoiseGit, from repository setup to conflict resolution and pushing changes back to GitLab, all without using the command line. Whether you’re new to Git or transitioning from CLI to GUI tools, these instructions will help you merge branches confidently and effectively.

Understanding GitLab and TortoiseGit

What is GitLab?

GitLab is a web-based platform that hosts Git repositories and integrates Continuous Integration/Continuous Deployment (CI/CD) workflows. It centralizes source control, project management, and automation, facilitating collaboration across distributed teams.

What is TortoiseGit?

TortoiseGit is a graphical Git client for Windows that integrates directly with Windows Explorer. It simplifies common Git tasks by providing an accessible interface for users who prefer not to use command-line tools, making it ideal for developers and technical teams embracing GUI workflows.

Prerequisites

Before you begin, ensure you have:

  • A GitLab account with access to the relevant repository
  • TortoiseGit installed on your Windows machine (latest version recommended)
  • Basic familiarity with Git concepts such as branches and commits
  • Proper permissions to merge branches within your GitLab project

Step-by-Step Guide

Step 1: Cloning the Repository (first-time setup only)

Open your GitLab project in a browser and copy the repository’s HTTPS or SSH URL.

In Windows Explorer, navigate to the directory where you want the local copy.

Right-click inside the folder and select Git Clone… from the TortoiseGit menu.

Paste the repository URL into the URL field and click OK.

Wait for the repository to clone successfully onto your local machine.

Note: If you already have the repository cloned locally, you can skip this step.

Clone GitLab repository using TortoiseGit Git Clone option

Step 2: Configuring TortoiseGit for GitLab

If you plan to use SSH URLs:

  • Generate an SSH key if you don’t have one already (via ssh-keygen or PuTTYgen).
  • Add your public SSH key to your GitLab account under Settings > SSH Keys.

Next, configure TortoiseGit with your user details:

  1. Right-click inside the cloned repository folder.
  2. Select TortoiseGit > Settings.
  3. Under Git > Config, set your username and email to match your GitLab identity.
  4. Save and close the settings window.

Tip: You can configure settings globally for all repositories, or locally for this specific repository.

Configure TortoiseGit user info settings for GitLab integration

Step 3: Preparing for the Merge

Before merging:

  • Fetch the latest changes from the remote repository: Right-click → TortoiseGit > Fetch.
  • Then, Pull the target branch to make sure it’s current.
  • Confirm that both your source branch (with the new changes) and target branch (the branch to merge into) are up-to-date.
Open TortoiseGit pull option to prepare for merge

Step 4: Switching to the Target Branch

Right-click the repository folder.

Go to TortoiseGit > Switch/Checkout…

Select the branch you want to merge into (e.g., main or develop).

Click OK to switch your working directory to the target branch.

Switch branches in TortoiseGit to target GitLab branch

Step 5: Merge the Source Branch

Right-click the repository folder again.

Select TortoiseGit > Merge…

In the Merge dialog, choose the source branch you want to merge from.

Click OK to initiate the merge.

Select TortoiseGit merge option to merge source branch

Note:- You are merging the selected source branch into the currently checked-out target branch.

Select source branch in TortoiseGit merge options window

Step 6: Handling Merge Conflicts for Modified Files

If your branches have conflicting changes, TortoiseGit will notify you.

Click Edit Conflicts to open TortoiseGitMerge.

Review conflicting files side-by-side.

  • Mine = your current branch (target).
  • Theirs = the incoming branch (source).

Choose which changes to keep or edit manually.

Save the file, then mark it as Resolved in TortoiseGit.

Commit the resolved files to continue the merge process.

Resolve merge conflicts in modified files using TortoiseGit

Note:- Select all modified files then commit your changes (Ok).

TortoiseGit resolve window showing empty file list

Step 7: Verifying the Merge

Use TortoiseGit’s overlay icons in Windows Explorer to check file status:

  • Green checkmark = clean/committed.
  • Red exclamation mark = modified.
  • Yellow triangle = conflicted.

Note: Icons indicate file states, not merge success/failure. Always test your application locally after a merge to confirm functionality.

Verify GitLab branch merge by checking updated repository folder

Step 8: Commit the Merge

Right-click the repository folder and select TortoiseGit > Commit…

Review all changes in the commit dialog.

Enter a clear and descriptive commit message explaining the merge (e.g., “Merged feature-branch into main”).

Click OK to commit the merge locally.

Commit merged changes to GitLab branch using TortoiseGit

Note:- Select all files for modified by you. Then commit or push or commit&push, also make sure enter a descriptive commit message in the message box.

TortoiseGit commit dialog showing modified files before commit

Step 9: Push the Merge to GitLab

Right-click on the repository folder.

Select TortoiseGit > Push…

Confirm the correct destination branch is selected for pushing.

Click OK and provide authentication credentials if prompted.

Wait for the push to complete successfully, updating the remote repository.

Push merged branch changes to remote GitLab using TortoiseGit

Note on protected branches: If GitLab prevents direct pushes to main or develop, push your feature branch and create a Merge Request instead.

Conclusion

Merging branches in GitLab using TortoiseGit is an accessible, visual way to manage collaboration without relying on the CLI. This approach is especially valuable for developers new to Git or those preferring GUI tools on Windows.

By following these steps:- cloning, configuring, switching branches, merging, resolving conflicts, and pushing changes, you can maintain a clean and efficient workflow in GitLab.

Pro Tip: Always pull the latest changes and coordinate merge plans with your team to minimize conflicts and maintain code quality.

If you found this guide helpful or have questions, feel free to leave a comment or share your experiences.

FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail

Comments are closed.

Fill in form

and we will contact you

How can we help ?

Schedule a quick call, 15-minute meeting with one of our experts:

Thank You !

Our consultant will contact you in 24 hours.

Delivering generous mobile apps for Entrepreneurs, Startups & Businesses


Have a look at nopAccelerate Demo Store with 80,000+ products with nopAccelerate Solr and CDN Plugin.

download-trial Start Trial