Skip to main content

Command Palette

Search for a command to run...

Day 33: Resolve Git Merge Conflicts | 100 Days of DevOps

Updated
3 min read
R
I’m currently working in DevOps and documenting my learning journey along the way. From CI/CD pipelines to cloud and containers, I’m exploring how modern systems are built and deployed. This blog is where I share what I learn, break down concepts in simple terms, and track my progress. Learning one concept at a time, and trying to apply it practically.

Content:

Today I worked on resolving a Git merge conflict while pushing changes to a shared repository. The task involved synchronizing local and remote changes, fixing a conflict in a file, and ensuring data consistency before successfully pushing updates.


🔹 What I Learned

  • Why merge conflicts occur in Git (when multiple users modify the same file)
  • How to resolve conflicts manually using conflict markers
  • The importance of pulling latest changes before pushing
  • How to combine changes from local and remote repositories
  • How to fix content issues (like typos) during conflict resolution

Steps I Followed

1. Connected to Storage Server

ssh max@ststor01

2. Navigated to the Repository

cd /home/max
ls
cd story-blog/
ls

3. Checked Git Status

git status

Observed:

  • Branch was ahead of origin/master by 1 commit
  • Working tree was clean

4. Attempted to Push Changes

git push origin master

❌ Push failed because the remote repository had new changes


5. Pulled Latest Changes from Remote

git pull origin master

Observed:

  • Merge conflict occurred in story-index.txt

6. Checked Conflict Status

git status

Observed:

  • Branches had diverged
  • story-index.txt showed as unmerged

7. Resolved Merge Conflict

vi story-index.txt

Issue Found:

  • Conflict markers present (<<<<<<<, =======, >>>>>>>)
  • Typo: "Mooose" → "Mouse"
  • Missing one story entry in remote version

Final Correct Content:

1. The Lion and the Mouse
2. The Frogs and the Ox
3. The Fox and the Grapes
4. The Donkey and the Dog

8. Staged the Resolved File

git add story-index.txt

9. Committed the Changes

git commit -m "Resolved merge conflict in story-index and fixed typo"

10. Pushed Changes Successfully

git push origin master

✅ Push completed without errors


🔹 My Understanding

This task helped me understand how Git handles conflicts when multiple contributors modify the same file. Instead of automatically merging, Git requires manual intervention to ensure correctness. I learned how to carefully review both versions, resolve conflicts, and maintain data integrity before committing.


🔹 What I Found Interesting

I found it interesting how Git clearly marks conflicting sections, making it easier to identify differences. Resolving conflicts manually gave me better control over the final content, and it reinforced the importance of collaboration and synchronization in version control.


📌 Full notes: GitHub link