Imiyalezo yokuzibophelela kwi-Git ihlala ingahoywa. Abaninzi bawabona njengobubi obuyimfuneko ukugcina utshintsho. Imiyalezo yokuzibophelela enentsingiselo yeyona nto ibalulekileyo kwimpumelelo yeprojekthi: Iqinisekisa ukulandeleka kakuhle kweenguqu, intsebenziswano esebenzayo phakathi kweqela kunye nokusombulula ingxaki ngokukhawuleza. Akukho sizathu sokuba imiyalezo yokuzibophelela ilungiswe ngokuzenzekelayo ngoncedo lwe-AI.
Ngoncedo lwento ebizwa Iihuka Kuyenzeka ukwenza izikripthi, umzekelo wokuvavanya ngokuzenzekelayo okanye ukujonga ikhowudi, kwiziganeko ezithile ngexesha lokuhamba komsebenzi weGit. Icala lomxhasi lungiselela-zibophelele-msg-Hook iba ngoko nangoko ngaphambili yenziwe emva kokuvula isibophelelo somhleli. Umzekelo, i-bash script ilandelayo kufuneka ibe kwifolda ~/git-template/hooks/prepare-commit-msg
ifayilishwe:
0d311d3e3743f65bd1f7fa370c3b3848
Ekugqibeleni, wongeza eyakho Iqhosha le-OpenAI API kumgca we-4 kwaye, ukuba unqwenela, lungisa imodeli ye-ChatGPT esetyenziswe kumgca we-5 (kumzekelo wethu gpt-4o
). Emva koko senza iskripthi siphunyezwe chmod +x ~/git-template/hooks/prepare-commit-msg
kunye nokubheja git config --global core.hooksPath ~/git-template/hooks
ulawulo olungagqibekanga lweehuku zeGit kuqwalaselo lweGit yehlabathi.
Umbhalo uvelisela i yahluka Zonke iifayile zenqanaba zifumana ngokuzenzekelayo itemplate efanelekileyo yomyalezo wokuzibophelela: git add -A . && git commit
. Kungenjalo, ungathumela kwakhona umyalezo ongenanto (""), oya kuthi ke ubhalwe ngaphezulu ngokuzenzekelayo: git add -A . && git commit -m "." && git push
– Kodwa lumka: Ukuqinisekiswa komyalezo akusenakwenzeka apha.
Iimodeli ze-AI ngoku zihambele phambili kakhulu kangangokuba imiyalezo ezenzekelayo yokuzibophelela yenziwa ngokusekwe kutshintsho. Ngokuhlenga-hlengisa i-prompt (ukusuka kumgca we-13) ungayandisa ngakumbi imbuyekezo. Ngendlela, iskripthi sikwasebenza kwiGit UI izixhobo ezifana Inqaba kwaye SmartGit. Ukuba ufuna ukuyivala indlela yokuziphatha kwakhona, cinezela nje git config --global --unset core.hooksPath
.