Resolving Git Merge Conflicts with GitHub

📘 #100DaysOfDevOps – Day 12 (GitHub – Day 3) Today I learned about Merge Conflicts in Git and how to resolve them ⚔️ Merge conflicts happen when multiple changes are made to the same file/line in different branches, and Git is unable to decide which change to keep. --- 🔹 When do Merge Conflicts occur? • Same file edited in multiple branches • Same line modified differently • While merging branches --- 🔹 Example of Conflict <<<<<<< HEAD Hello from main branch ======= Hello from feature branch >>>>>>> feature-1 --- 🔹 How to Resolve Conflict 1️⃣ Open the conflicted file 2️⃣ Choose correct changes (or combine both) 3️⃣ Remove conflict markers ("<<<<<<", "======", ">>>>>>") 4️⃣ Add and commit changes git add file.txt git commit -m "Resolved merge conflict" --- 🔹 Useful Commands Check status "git status" Abort merge "git merge --abort" --- 🔹 Best Practices • Pull latest changes before working • Work on separate branches • Keep commits small and clear --- 💡 Key Learning: Handling merge conflicts is an essential skill for collaboration and maintaining clean code in real-world DevOps projects. Learning something new every day 🚀 #100DaysOfDevOps #DevOps #Git #GitHub #LearningInPublic

  • graphical user interface

To view or add a comment, sign in

Explore content categories