Imilayezo yokuzibophezela ku-Git ivame ukunganakwa. Abaningi bazibona njengobubi obudingekayo ukuze kugcinwe izinguquko. Imilayezo yokuzibophezela okunenjongo iyisici esibalulekile empumelelweni yephrojekthi: Iqinisekisa ukulandeleka okuhle kwezinguquko, ukubambisana okuphumelelayo phakathi kweqembu kanye nokuxazulula izinkinga ngokushesha. Asikho isizathu sokuthi imilayezo yokuzibophezela ilungiswe ngokuzenzakalelayo ngosizo lwe-AI.
Ngosizo lwalokho okubizwa Izingwegwe Kungenzeka ukwenza imibhalo, isibonelo yokuhlola okuzenzakalelayo noma ukuhlola ikhodi, ezehlakalweni ezithile phakathi nokugeleza komsebenzi we-Git. Uhlangothi lweklayenti lungiselela-zibophezele-msg-Hook iba ngokushesha ngaphambili yenziwe ngemuva kokuvula isihleli sesibopho. Isibonelo, umbhalo we-bash olandelayo kufanele ube kufolda ~/git-template/hooks/prepare-commit-msg
afakwe:
0d311d3e3743f65bd1f7fa370c3b3848
Ekugcineni, wengeza eyakho Ukhiye we-OpenAI API kulayini 4 futhi, uma uthanda, lungisa imodeli ye-ChatGPT esetshenziswe kulayini 5 (esibonelweni sethu gpt-4o
). Bese senza iskripthi sisebenze chmod +x ~/git-template/hooks/prepare-commit-msg
nokubhejwa nge git config --global core.hooksPath ~/git-template/hooks
umkhombandlela ozenzakalelayo wamahhuku e-Git ekucushweni kwe-Git yomhlaba wonke.
Iskripthi sikhiqizela i- diff Wonke amafayela asesiteji athola ngokuzenzakalelayo isifanekiso esifanelekile somlayezo wokuzibophezela: git add -A . && git commit
. Kungenjalo, ungaphinda uthumele umlayezo ongenalutho ("."), ozosulwa ngokuzenzakalelayo: git add -A . && git commit -m "." && git push
– Kodwa qaphela: Ukuqinisekiswa komlayezo akusenzeki lapha.
Amamodeli we-AI manje asethuthuke kakhulu kangangokuthi imilayezo enengqondo yokuzibophezela iyadalwa ngokusekelwe ezinguqukweni. Ngokulungisa ukwaziswa (kusuka kulayini 13) ungathuthukisa ngokuqhubekayo imbuyiselo. Ngendlela, iskripthi sisebenza futhi kumathuluzi we-Git UI afana Umbhoshongo futhi I-SmartGit. Uma ufuna ukuvala ukusebenza futhi, vele ucindezele git config --global --unset core.hooksPath
.