Prins pas / Cemût che al funzione mergecat
Cemût che al funzione mergecat
Cemût che mergecat al trasforme la storie Git di un branch in changeset, al da un non ai branch integrâts e al trate squash, rebase e altris stîi di integrazion.
Tradusude dal inglês cul jutori de IA. In câs di dubi e vâl la version in inglês.
mergecat nol invente struturis: dut ce che al mostre al ven dal grafic dai commit, dai messaçs dai commit e, cuant che al è conetût, des pull request dal servizi di hosting. Cheste pagjine e spieghe lis regulis, cussì tu puedis prevedi ce che tu viodarâs e ricognossi cuant che une storie no lis rispiete.
Il percors dal prin gjenitôr
Cuant che tu fasis il merge di une funzionalitât in main, il commit di merge al regjistre doi gjenitôrs: il prin al è il commit dulà che al jere main, il secont al è la ponte de funzionalitât. Lant daûr dome dai prins gjenitôrs, partint de ponte di un branch, si oten la sô linie principâl (mainline): la secuence dai stâts che il branch stes al à passât.
mergecat al cjamine par cheste cjadene di prins gjenitôrs, dal plui gnûf, e al trasforme ogni commit che al cjate intun element:
| Commit su la linie principâl | Element |
|---|---|
| Un gjenitôr | Un commit diret: fat sul branch stes, une rie. |
| Doi o plui gjenitôrs | Une integrazion (changeset): un merge, mostrât come grup cui commit che al à puartât dentri. |
Ce che al conten une integrazion
Par un merge M cui gjenitôrs P1, P2..Pn, il grup al conten i commit che si cjatin partint di P2..Pn ma no partint di P1. In tiermins di Git:
git log P2..Pn ^P1
Chescj a son pardabon i commit che a son jentrâts tal branch midiant di M. In chest esempli, il merge di feature in M al puarte dentri C e D:
main A───B───────M
\ /
feature C───D
Integrazion indenant
I feature branch dispès a tornin a fâ il merge di main dentri di lôr par restâ inzornâts («merge main into feature»). I commit rivâts di main in cheste maniere si cjatin partint di P1, duncje no vegnin contâts une altre volte tal grup de funzionalitât. I commit «merge main into feature» stes a son platâts par impostazion predefinide: no àn puartât nuie di gnûf tal branch.
Disative Plate i merge di integrazion indenant in Filtris par viodiju. Alore a comparissin dentri dal grup cuntune etichete integrazion indenant.
Merge nidiâts
Cuant che la funzionalitât A e ven integrade te funzionalitât B, e B in main, A e devente un sotgrup dentri dal changeset di B, segnât come Merge interni. Slargjilu par viodi i commit di A.
Merge octopus
Un merge di trê o plui branch tun colp sôl al à la etichete octopus. Il so grup al à une linie par ogni branch integrât, ognune cul non dal branch in teste, e la colone Branch / PR e unìs i nons cun +.
Merge vueits
Un merge che nol à puartât dentri nissun commit che nol fos za sul branch al à la etichete vueit.
Dâ un non al branch integrât
Git nol salve i nons dai branch tai commit. mergecat al cîr il non in chest ordin e si ferme ae prime sorzint che lu à:
- Il messaç dal merge. Al funzione cence rêt e al reste ancje dopo che il branch al è stât eliminât.
- La pull request dal servizi di hosting (modalitât conetude). E funzione ancje dopo che il branch al è stât eliminât.
- Un branch che al ponte ancjemò al commit integrât, locâl o remot.
- Il SHA curt dal commit integrât, cuant che no si sa nuie altri.
Met il pontadôr parsore di une etichete dal branch par viodi cuale sorzint che e je stade doprade; il panel dai detais le mostre sot di Branch. Cuant che il non nol è cognossût e une conession lu podarès ricavâ, la etichete e mostre une icone cul lucut.
Chescj messaçs di merge a vegnin ricognossûts:
| Scrit di | Messaç | Ce che al lei mergecat |
|---|---|---|
git merge | Merge branch 'feature/x' into main, Merge branches 'a', 'b' and 'c' | Nons dai branch |
git pull | Merge branch 'x' of https://… | Non dal branch |
git merge di un branch remot | Merge remote-tracking branch 'origin/x' | Non dal branch cence il remote |
git merge di un tag | Merge tag 'v1.2.0' | Non dal tag |
| GitHub | Merge pull request #12 from org/feature-x | Numar de pull request e branch |
| GitLab | Merge branch 'x' into 'main' cun See merge request group/project!12 tal cuarp dal messaç | Branch, numar e titul de merge request |
| Bitbucket | Merged in feature-x (pull request #12) | Branch e numar de pull request |
| Azure DevOps | Merged PR 12: Title | Dome numar e titul de pull request |
Une convenzion che e ten i nons leibii
Complete lis pull request cuntun commit di merge (no fast-forward) e met il non dal branch o l’ID dal work item tal titul de pull request. Il titul al finìs tal messaç dal merge e al reste ancje dopo che il branch al è stât eliminât.
Stîi di integrazion
Il mût che il to team al complete lis pull request al decît ce che e conten la storie. mergecat al mostre ogni stîl cun dute la fedeltât che il grafic al permet e al dîs cuant che i grups no son complets.
| Cemût che a vegnin completadis lis pull request | Ce che al mostre mergecat |
|---|---|
| Commit di merge (no fast-forward), cul semi-linear merge di Azure DevOps | Grups. |
| Squash | Un commit. Segnât squash cuant che il messaç al somee a une pull request (Title (#12), Merged PR 12: Title, il Merged in di Bitbucket). Conetût: segnât PR cun squash merge, e il panel dai detais al liste i commit origjinâi. |
| Rebase e fast-forward | Commit direts. Conetût: metûts in grups par pull request come PR cun rebase merge. |
Fast-forward di une funzionalitât che e à doprât la integrazion indenant, o merge di git pull sul branch stes | Segnât invertît: di li indenant il percors dal prin gjenitôr al podarès lâ daûr de bande sbaliade (merge «foxtrot»). |
| Clon shallow | Un avîs; i grups a podaressin jessi incomplets. Il commit dulà che la storie e je taiade al è segnât shallow. |
Cuant che une di chestis situazions e tocje il branch, parsore de liste e compar une sbare di avîs:
| Avîs | Cuant |
|---|---|
| Chest branch nol à commit di merge | Ogni element al è un commit diret, di solit par vie di merge cun rebase o fast-forward. Conet il servizi di hosting par metiju in grups. |
| Chest branch nol ven integrât cun merge no-fast-forward | Nissun merge, e lis pull request a somein integradis cun squash merge. |
| Stîi di integrazion messedâts | Cualchi pull request e somee integrade cun squash merge in mieç di merge normâi. |
N merge(s) merged "main" into something else | Un o plui merge invertîts. |
| Chest al è un clon shallow | Eseguìs git fetch --unshallow par vê risultâts complets. |
Altris informazions su ogni limit e su cemût evitâlu: Limits e stîi di integrazion.
Prestazions
mergecat nol invie un procès Git par ogni merge. Al lei dute la storie dal branch cun un sôl git log, po al calcole i grups in memorie: al cjamine te cjadene dai prins gjenitôrs scomençant dal commit plui vecjo e al lasse che ogni merge al cjapi i commit che nissun nol à ancjemò cjapât. Il cost al cres in maniere lineâr cul numar dai commit; une storie di 11.000 commit e ven indicizade in tant mancul di un secont. La intestazion de liste e mostre trop timp che e à doprât la ultime leture (read in … ms).
Il rest dal lavôr al ven fat dome cuant che al covente:
- i diff a vegnin calcolâts cun
git diffcuant che tu selezionis une rie; - i dâts des pull request (conetût) a vegnin cjariâts pai elements che tu stâs cjalant e tignûts in cache par SHA dal commit, cussì a restin valits ancje dopo i fetch;
- lis storiis letis plui di recent a restin in memorie, cussì tornâ suntun branch che la sô ponte no si è movude al è imediât.
Liste e grafic
La pagjine Storie e mostre la stesse storie in dôs disposizions:
- Liste: i changeset, cun integrazions che tu puedis slargjâ par viodi i commit che a àn puartât dentri.
- Grafic: ogni commit cu lis sôs liniis, come
git log --graph, calcolât une volte sole par dute la storie. Ogni commit al à une etichete cul changeset che lu à puartât tal branch; la etichete e je metude in evidence sul commit che lu à integrât.
La disposizion a grafic: ogni commit, segnât cul so changeset.
Dome in leture par sielte
mergecat al eseguìs comants Git che a lein. Al scrîf dome cuant che tu tu invîs une azion:
| Azion | Ce che al ven eseguît |
|---|---|
| Fetch te pagjine Branch | git fetch --all --tags --prune (i tiei branch locâi no vegnin cambiâts) |
| Gnûf tag, Push | git tag, git push <remote> refs/tags/<name> |
| Gnove pull request | Une clamade al servizi di hosting |
Il fetch e il push dai tag a doprin lis tôs credenziâls di Git (il to credential helper); mergecat nol domande mai une password di Git.