Magance rikice-rikice a cikin Git: Jagora don Ingantacciyar Magance Rikici

Lokacin aiki tare da Git, rikice-rikice suna faruwa lokacin da aka sami karo ko karo tsakanin canje-canje a lambar tushe.

Misali, mutane biyu suna yin gyara zuwa layi ɗaya a cikin fayil. A irin waɗannan lokuta, Git ba zai iya tantance sigar ƙarshe ta atomatik ba kuma yana buƙatar sa hannun mai amfani don warware rikicin.

Anan ga cikakkun matakai don magance rikice-rikice a Git:

 

Gano rikici

Lokacin da kuka aiwatar da umarni git merge ko git pull kuma rikice-rikice sun taso, Git zai sanar da ku game da rikicin kuma ya nuna jerin fayilolin masu karo da juna.

 

Duba fayilolin masu karo da juna

Bude fayilolin masu cin karo da juna a cikin editan rubutu kuma gano wuraren sassan lambar masu karo da juna. Za a yiwa sassan masu karo da juna alamar "<<<<<<<", "=======", da ">>>>>>>.

Misali:

<<<<<<< HEAD  
Code from your branch  
=======  
Code from the other branch  
>>>>>>> other-branch  

 

A warware rikicin

Gyara lambar tushe don warware rikicin. Kuna iya ajiye wani yanki na lambar, canza lambar da ke akwai, ko ma musanya duk lambar da sabuwar sigar gaba ɗaya. Manufar ita ce tabbatar da cewa lambar tushe tana aiki daidai kuma ta cika bukatun aikin bayan warware rikici.

Misali, bayan warware rikicin:

Updated code that resolves the conflict

 

Aiwatar da canje-canje bayan warware rikici

Yi amfani da git add umarnin don tsara fayil ɗin da aka warware don aikatawa. Sannan, yi amfani da git commit umarnin don ƙirƙirar sabon alƙawarin da ke rikodin canje-canjen da aka warware.

Misali:

git add myfile.txt  
git commit -m "Resolve conflict in myfile.txt"  

 

Lura: A yayin aiwatar da warware rikici, ƙila za ku buƙaci tattaunawa da haɗin gwiwa tare da sauran membobin ƙungiyar don cimma matsaya kan ƙudurin da ya dace don rikicin.

Ta bin waɗannan matakan, zaku iya magance rikice-rikice a cikin Git yadda ya kamata, tabbatar da ci gaba da aiki tare a cikin haɓaka software da tsarin sarrafa lambar tushe.