मर्ज कॉन्फ्लिक्ट्स

इंटरमीडिएट Git

George Boorman

Curriculum Manager, DataCamp

Conflicts

  • कॉन्फ्लिक्ट

    • ब्रांचों के बीच एक या अधिक फाइलों की सामग्री में अंतर न सुलझ पाना
  • दो ब्रांचों में एक ही फाइल एडिट करें

  • मर्ज करने की कोशिश करें

  • Git नहीं जानता कौन-सा वर्ज़न रखें

  • कॉन्फ्लिक्ट!

इंटरमीडिएट Git

README.md के टकराते वर्ज़न

documentation ब्रांच

# Contents and usage

This repo contains source code 
for the DataCamp website.

It also contains source code for an 
AI-Assistant (recommendation system) 
that takes prompts from learners and 
returns suggested content
that they might be interested in. 

It is for internal use only, 
external access is prohibited.

main ब्रांच

# Contents and usage

This repo contains source code 
for the DataCamp website.

It is for internal use only, 
external access is prohibited.
इंटरमीडिएट Git

मर्जिंग

  • main ब्रांच से
git merge documentation
Auto-merging README.md
CONFLICT (add/add): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
इंटरमीडिएट Git

फाइल खोलना

nano README.md

nano में कॉन्फ्लिक्ट सेक्शंस दिखाती README फाइल

इंटरमीडिएट Git

Git कॉन्फ्लिक्ट सिंटैक्स

एनोटेटेड कॉन्फ्लिक्ट फाइल: main बनाम documentation ब्रांच की सामग्री

इंटरमीडिएट Git

कॉन्फ्लिक्ट सुलझाना

nano वेब एडिटर में Git सिंटैक्स <<<<<<< documentation, =======, और >>>>>>> HEAD हटाते हुए

  • सेव: Ctrl + O (ना कि Ctrl + 0), फिर Enter
  • बाहर निकलें: Ctrl + X
इंटरमीडिएट Git

ब्रांचों को मर्ज करना

  • कॉन्फ्लिक्ट सुलझने के बाद मर्ज करें
git add README.md
git commit -m "Resolving README.md conflict"
git merge documentation
Already up to date.
  • रोकथाम इलाज से बेहतर है!
इंटरमीडिएट Git

अभ्यास करते हैं!

इंटरमीडिएट Git

Preparing Video For Download...