How to resolve Git merge conflicts?

QuestionsQuestions8 SkillsProDec, 24 2025
0124

It looks like you've encountered a Merge Conflict in your .github/workflows/ci.yml file. This happens because Git doesn't know which version of the file to keep—the one from GitHub or the one you just created.

Don't worry! Here is the step-by-step guide to fixing it:

1. Identify the Conflict

Run git status to see which files are causing the trouble. In your case, it’s:
.github/workflows/ci.yml.

2. Open the File

Open the file in the WebIDE (VSCode) or vim. You will see "Conflict Markers" that look like this:

<<<<<<< HEAD
# Your local changes are here
  - name: List files
    run: ls -la
=======
# Changes from GitHub are here
  - name: Run some other command
    run: echo "Hello"
>>>>>>> origin/main

3. Edit the File

To resolve the conflict:

  1. Delete the markers (<<<<<<<, =======, >>>>>>>).
  2. Keep the code you actually want. Since this lab is about the checkout action, make sure your final file contains:
    - name: Checkout repository
      uses: actions/checkout@v4
    - name: List files
      run: ls -la

4. Stage and Commit the Fix

Once the file looks correct and the markers are gone, tell Git you've fixed it by running these commands in the terminal:

# 1. Add the resolved file
git add .github/workflows/ci.yml

# 2. Complete the merge (or rebase)
git commit -m "chore: resolve merge conflict in workflow"

5. Push to GitHub

Now that the conflict is resolved locally, push your code to see the Action run:

git push origin main

Labby Tip: Conflicts are a normal part of working with Git! Once you push, go back to the Actions tab on GitHub as described in the lab instructions to see your "List files" step in action.

0 Comments

no data
Be the first to share your comment!