Understanding and Resolving Merge Conflicts in GIT

Prerequisites

  • Windows 11 PC
  • Internet or network access to your GitLab self-hosted instance
  • Access to your self-hosted GitLab URL from your organization or administrator
  • Visual Studio Code (recommended for editing code and working with Git)

Step 1: Download Git

  1. Open your web browser.
  2. Go to the official Git website:
  3. Click Download for Windows.
  4. The download should start automatically.

Step 2: Install Git

  1. Double-click the downloaded installer.
  2. Click Yes if prompted by User Account Control.
  3. Click Next through the installation wizard.

For most users, the default settings are recommended.

Recommended Installation Options

  • Select Components
    • Keep the default options selected.
    • Click Next.
  • Default Editor
  • Adjust Initial Branch Name
    • Choose Override the default branch name for new repositories.
    • Enter:main
    • Click Next.
  • Adjust PATH Environment
    • Select:Git from the command line and also from 3rd-party software
    • Click Next.
  • HTTPS Transport Backend
    • Leave the default:Use the OpenSSL library
    • Click Next.
  • Line Ending Conversions
    • Leave the default:Checkout Windows-style, commit Unix-style line endings
    • Click Next.
  • Terminal Emulator
    • Select:Use MinTTY (the default terminal)
    • Click Next.
  • Continue clicking Next until Install appears.
  1. Click Install.
  2. Wait for the installation to complete.
  3. Click Finish.

Step 3: Verify Git Installation

  1. Open Command Prompt, PowerShell, or the terminal in Visual Studio Code.
  2. Run:
git --version

Example output:

git version 2.xx.x.windows.x

If you see a version number, Git has been installed successfully.


Step 4: Configure Git

Set your name:

git config --global user.name "Your Name"

Example:

git config --global user.name "John Smith"

Set your email address:

git config --global user.email "your@email.com"

Example:

git config --global user.email "john@email.com"

Step 5: Verify Your Configuration

Run:

git config --list

Example output:

user.name=John Smith
user.email=john@email.com
init.defaultBranch=main

Step 6: Check the Default Branch

Run:

git config --global init.defaultBranch main

This ensures that all newly created repositories use main as the default branch.


Step 7: Access Your Self-Hosted GitLab Instance

  1. Open your browser.
  2. Visit the URL provided by your organization or administrator, for example:
    • https://gitlab.yourcompany.com
  3. Sign in with your self-hosted GitLab credentials.
  4. If you do not have an account, contact your GitLab administrator to create one or grant access.

Step 8: Confirm Everything Is Ready

Run these commands:

git --version
git config --list

If both commands work without errors, your Git installation is complete and ready to use with your self-hosted GitLab instance.


Next Tutorial

The next part of this guide will cover:

  • Understanding Git and self-hosted GitLab
  • Creating your first project in self-hosted GitLab
  • Connecting Git to your GitLab server
  • Creating repositories
  • Cloning repositories
  • Making commits
  • Pushing changes
  • Pulling updates
  • Branching and merging
  • Resolving merge conflicts
  • Best practices

Click Here to view the Next tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.