# 🚀 Day 7 of 100 Days of DevOps – Git Branching, Merging & Conflict Resolution

Ritesh SinghRitesh Singh
3 min read

🧠 What I Learned

ConceptSkill Gained
git branchCreate and manage branches
git checkout -bCreate and switch to a new branch
git mergeMerge one branch into another
Merge ConflictsIdentify and resolve conflicts manually
git log --oneline --graphVisualize branch history

✅ Commands I Practiced

🔀 1. Create a new Git repository

mkdir git-practice-lab
cd git-practice-lab
git init

🌿 2. Create a new branch

git branch feature-a

Check all branches:

git branch

🚀 3. Switch to a branch

git checkout feature-a

Or create and switch:

git checkout -b feature-b

📝 4. Make some changes

echo "This is feature A" > file.txt
git add .
git commit -m "Add feature A content"

Switch back to main and make a conflicting change:

git checkout main
echo "This is MAIN version" > file.txt
git commit -am "Update from main"

🔀 5. Merge and resolve conflicts

git merge feature-a

🛑 Conflict message appears if both branches modified the same part of the file.

Resolve it manually:

  • Open the file

  • Edit to keep the correct version

  • Save and run:

git add file.txt
git commit -m "Resolve conflict between main and feature-a"

🧪 Bonus: Visualize Branch History

git log --oneline --graph --all

Shows a visual tree of your branches and commits.


🛠️ Summary of Key Commands

CommandUse Case
git branchList or create branches
git checkout branch_nameSwitch to branch
git checkout -b new_branchCreate + switch
git merge branch_nameMerge into current branch
git statusCheck working tree
git log --oneline --graphVisualize history
git diffSee changes
git add and git commitSave changes

⚔️ What I Learned from Conflicts

Merge conflicts happen when:

  • Two branches modify the same lines of a file

  • Git cannot automatically resolve the difference

🧠 I learned to:

  • Read conflict markers (<<<<<<<, =======, >>>>>>>)

  • Edit files manually

  • Add and commit after resolving


📌 Reflections

“Branching and merging are not optional — they are essential for working in teams. Conflict resolution is an art that becomes easier with practice.”


📂 Files Created


🔗 Resources


📘 Next Steps

  • ✅ Push this Git exercise to GitHub

  • ✅ Start a Hashnode blog explaining the conflict resolution visually

  • 🔜 Learn how to stash changes and cherry-pick commits


0
Subscribe to my newsletter

Read articles from Ritesh Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ritesh Singh
Ritesh Singh

Hi, I’m Ritesh 👋 I’m on a mission to become a DevOps Engineer — and I’m learning in public every single day.With a full-time commitment of 8–10 hours daily, I’m building skills in: ✅ Linux✅ Git & GitHub✅ Docker & Kubernetes✅ AWS EC2, S3✅ Jenkins, GitHub Actions✅ Terraform, Prometheus, Grafana I post daily blogs on Hashnode, push projects to GitHub, and stay active on LinkedIn and Twitter/X. Let’s connect, collaborate, and grow together 🚀 #100DaysOfDevOps #LearningInPublic #DevOps