He tauira angitu o manga i roto i te Git

Ako ki te whakamahi i he nui Git, a kau whakaū i tenei he pūmanawa whakahaere taiao whanaketanga mahi tahi.

whiwhinga

Tenei Post Ko te putanga Portuguese o taketake, i roto i te reo Ingarihi, “He Git tauira wana angitu“, ata mana e te kaituhi, Vincent Driessen. Mauruuru koe te tangata!

Hoki ngā take hangarau, i opua puritia etahi kupu matua i roto i te reo Ingarihi. tamata ahau ki te whakarite i te pūtakenga o te kuputuhi, engari whakaae ahau e i ki te whakarerekē ki te whakahaere māramatanga i roto i tatou reo ahau (PT-BR). Tetahi ako mana'o ranei mo te whakapai ake i roto i te translation he pōwhiri.

whakataki

e kore te mea he pou whakaako i te whakamahi Git tenei. Ki te ko te tenei te mea hiahia, e faaite tango ahau i te titiro i mahi ā-Git. Kore ko reira ta tatou opuaraa ki te whakaatu pehea ki te hanga i te Pūtangatanga pūmanawa, i roto i tenei take, titiro Pūtangatanga pū.

Tenei te tono, ko te ki te whakahaere i rōpū mahi tahi i roto i te Pūtangatanga pūmanawa. e mohio ana koe, ina whai koutou hötaka maha “faaururaa” i roto i te waehere pūtake taua? He nui tenei ki te tere whanaketanga, engari ka taea e whakaputa ānini nui (ngaronga me te rework) ki te mea kahore he mana. Kia kore ai he kaiwhakawhanake i taupoki tetahi o mahi, me te whakarite whanaketanga ahu whakamua, me te whakaritea, whakaiti pakanga me te whakahaere i ngā putanga pūmanawa, tatou e whakamahi Git me tauira manga ki te whai.

manga tauira

I roto i tenei pou tapaea e ahau te tauira whanaketanga whakamahia ahau i roto i te tahi mau o toku kaupapa (e rua i te mahi, me te tūmataiti) tata 1 matahiti i ma'iri a'e, a kua reira rawa angitu. Ētahi wa mua hiahia ahau ki te tuhituhi e pā ana ki te reira, engari e kore i kitea te wa e wātea ana, pera tawhiti. e kore e kōrero ahau e pā ana ki ngā kōrero kaupapa, tika e pā ana ki ngā rautaki manga ka whakahaere putanga.

Tenei tauira e kore hiri anake Git rite he taputapu mō te Pūtangatanga o to tatou waehere katoa pūtake. (Ratau, ki te e paanga koe i roto i Git, to tatou kamupene gitpri ki whakarato, wā-tūturu, etahi tātari raraunga mīharo ki te pūmanawa engineering arotautanga)

aha git?

Hoki te kōrero tino o te pai me ngā raruraru o Git whakaritea ki ngā pūnaha whakahaere pūtake centralized, titiro he tukutuku. He he he rahi “whawhai” huri noa e. rite te kaiwhakawhanake, hiahia ahau Git i pā ana ki ētahi atu taputapu tīariari katoa i tenei ra. Git kore ke te ara ngā whakaaro e pā ana ki te hanga i te hanumi ranei te hanga i tētahi manga. haere mai ahau i te ao puāwaitanga Rātonga / whakaputa ke, te wahi hanumitanga / Pekanga Ko te tahi mea koutou anake te mahi kotahi i roto i te ia me te reira tonu te mea he iti wehiwehi (“Kia tupato o pakanga o hanumi, ngau ratou ia koutou!”).

¶ Na git enei mahi [hanumitanga / Pekanga] Ko ratou tino māmā, me te tohu i te wahi nui o to tatou mahi mahi, whakapono. hei tauira, kahore pukapuka CSV / whakaputa ke, kouru e hanumi E taupokina ratou mo te wa tuatahi anake i roto i pene i muri (hoki ngā kaiwhakamahi matatau), i roto i tetahi pukapuka i runga i Git, kitea tenei i roto i te pene 3 (taketake).

Ka rite ki te hua o tona tapatahi ka āhua auau, kouru e hanumi Ko ratou kore te tahi mea ki te wehi. tino, kia āwhina i te taputapu mana putanga hangahanumi a hanga manga neke atu i te tetahi atu.

korero nui, kia te tauira whanaketanga. Te tauira e ka tapaea e ahau i konei he tino kahore atu atu i te huinga o ngā tukanga e me whai mema i ia rōpū i roto i te tikanga ki te tiki ki te tukanga whanaketanga pūmanawa whakahaere.

wehenga, engari centralized

Ko te tatūnga pupuru e whakamahi tatou me e mahi tino pai ki tenei tauira kouru Kei te tito te reira o te pätaka pokapū. Kia mōhio e ko tika tenei pätaka “whakaaro” pokapū (no te mea ko Git he DVCS [Tūaritia Systems Mana Putanga], i roto i te mau parau te tahi atu, kahore he mea pēnei i te pätaka pokapū i runga i te taumata hangarau). Ka kōrero tatou ki tenei pupuru rite takenga, mai he waia ki ngā kaiwhakamahi katoa Git tenei ingoa.

Ia kaiwhakawhanake Ko faaho'i e pana i runga i takenga. Otiia tera taha te hononga pana-hutia hoki centralized [takenga], Ka taea hoki e ia kaiwhakawhanake hopu [wahia] huringa mō ētahi atu hoa ki te hanga i Subteams. hei tauira, taea e whai hua tenei ki te mahi ki rua, neke atu rānei ngā i runga i te taumahinga hou nui, te tuku i mua [e aki] te mahi i roto i te ahunga whakamua mō takenga. I roto i te i runga ake, i reira e iti-kapa o Alice ko Bob, Alice e Rawiri, e Clair ko Rawiri.

tū, tenei te tikanga kahore atu atu Alice kua tautuhia he Git mamao ko Bob, tuhu ki pupuru o Bob, me te hurihia tumuaki tuarua.

Ko te manga matua

i roto i te hoki, Kei te tino faauruhia tenei tauira whanaketanga e tauira tīariari i roto i reira. e rua nga peka e te pupuru pokapū [manga] ārahi ki te ora e kore e mutu:

  • ariki
  • whakawhanake

Ko te ariki manga i roto i takenga kia kia waia ki nga kaiwhakamahi Git. faitatau ki ariki manga, reira he tetahi manga ka karanga whakawhanake.

whakaaro tatou takenga / ariki rite te peka matua te wahi te pūtake HEAD whakaata tonu te āhua production-rite [rite mō te hanga].

whakaaro tatou takenga / whakawhanake rite te manga te wahi i te puna matua HEAD whakaata tonu te āhua ki te huringa whanaketanga hou ki te kia tukua i roto i te tuku i muri. e karanga reira etahi “manga pāwhaitua”. Ko te wahi tupu i te waihanga tino nanakia.

A, no te te waehere pūtake i roto i te whakawhanake peka tae te wāhi pūmau, me te he rite ki te kia tukua [tukua], Me hanumi huringa katoa [hanumi] ki te hoki i te ariki manga a ka tohua ki te tau putanga [tuku]. Kia pehea te mahi tenei te i roto i te taipitopito, Kei te kōrero atu.

reira, i ia wa e whakaurua te huringa [hanumi] hoki ki ariki, Kei te hangaia te reira i te putanga hou [tukua], i te whakamāramatanga. tamata tatou ki te kia tino tino e pā ana ki reira, ka, takahi, ara i taea e koe te whakamahi i te hōtuhi matau Git ki te waihanga aunoa, ka tonoa to tatou tono ki te tūmau production nga wa i reira he he e mahi ana kahore ariki.

manga ngaahi houalotú

taha te manga matua, ariki e whakawhanake, Ka whakamahia e to tatou tauira whanaketanga he momo o manga tautoko ki āwhina i te whanaketanga tukutahi i waenganui i ngā mema o te rōpū, aha 1) whakahaere te aroturuki a ngā āhuatanga hou [āhuatanga], 2) faaineine hoki tuku o te putanga hou [tuku] e 3) E tauturu te reira ki te whakatika hohoro kohakore i roto i te hanga [whakatikawera]. Hāunga i manga matua, Estes manga He he whanganga ora poto, mai ka iku e nekehia atu te reira.

Ko nga momo rerekē o manga [p∂p∂ tauturu] Ka taea e tatou te whakamahi i, ko ratou:

  • manga Āhuahira
  • manga tuku
  • manga whakatikawera

Ia o enei manga He he whakaaro motuhake, me te e herea e te ture tino, kia e, manga taea manga a manga totonu ke hanumi ratou [hanumi] ratou ngā taumata. Ka kite matou i ia [manga] i roto i te manawa.

Mai i te tirohanga hangarau, te hunga manga e kore ratou e whakaaro “motuhake”. Ia momo o manga Kei te wehewehea te reira i te ara whakamahi tatou. te mutunga, He kuware noa ratou manga mo Old Git.

manga Āhuahira

[Āhuatanga = āhuatanga / taumahinga]

– Ka taea e koe te tupu [manga] i:
whakawhanake
– whakauru ano te reira [hanumi] ano:
whakawhanake
– Te whakaingoa fakataha-lahi o manga:
tetahi, anake ariki, whakawhanake, release- *, ranei hotfix- *

te manga āhuatanga (ranei ētahi wā ka karangatia e manga kaupapa) E whakamahia ratou ki te whakawhanake i ngā āhuatanga hou / taumahinga mo te tuku heke mai i muri ranei. A, no te tīmata i te whanaketanga o te āhuatanga, kia pai kia mohiotia i tenei wāhi te tuku ūnga i roto i nei e kia whakaurua tenei āhuatanga.

Ko te ngako o te manga āhuatanga vai te reira i āhuatanga kei te whanake, engari ka faifai ka whakaurua reira [hanumi] hoki ki whakawhanake (ki te tāpiri tūturu te hou āhuatanga te muri tuku) whiua ranei (i roto i te take o te wheako kāore i).

manga Āhuahira te nuinga te tīariari anake i roto i te pätaka whakawhanake, e kore i roto i takenga.

Te hanga i te manga āhuatanga

$ Hokona git -b myfeature whakawhanake
# Switched to a new branch "myfeature"

Te whakauru i te āhuatanga oti i runga i whakawhanake

āhuatanga oti taea te hanumi[hanumi] ki whakawhanake peka ki te tāpiri ratou tūturu ki te muri tuku.

$ Hokona git whakawhanake
# Whakawhiti ki te peka 'whakawhanake'
$ haere git --kahore-myfeature ff
# whakahōu ea1b82a..05e9557
# (Whakarāpopototanga o ngā huringa)
# $ myfeature peka git -d
# myfeature peka Mukua (ko 05e9557).
$ takenga pana git whakawhanake

He kara –kahore-ff ai te reira i te hanumi [hanumi] waihanga tonu te ahanoa hou e mahi ana, ara, ki te taea te whakamana te hanumi ki te nohopuku-whakamua [ff]. mawehe tenei ngaro kōrero e pā ana ki te hītori o te oraraa o te manga āhuatanga, whakarōpū katoa mahia i honoa mai ratou kia āhuatanga. Whakataurite:

Kāore he take o muri [feruri i runga], e kore e taea ki te kite i te hītori Git i o mahia i whakatinana ratou i roto i te āhuatanga; e whai koe ki te pānui i ā nga karere katoa rangitaki. kōaro te āhuatanga katoa (i roto i te mau parau te tahi atu, he rōpū mahia), Ko te ānini i roto i te āhuatanga o muri, i te ngāwari te reira mahi ki te te haki –kahore-ff Kua whakamahia te reira.

Sim, ka hanga i tenei he torutoru atu ahanoa mahia (kau), engari he nui nui atu te utu i te taonga.

manga tuku

[Tuku = tuku / tuku / tuku]

– Ka taea e koe te tupu [manga] i:
whakawhanake
– whakauru ano te reira [hanumi] ano:
whakawhanake e ariki
– Te whakaingoa fakataha-lahi o manga:
release- *

te pānui manga te āwhina i roto i te faaineineraa i te putanga production hou [production tuku]. tukua ratou ki a koe tuu ira meneti whakamutunga o te i. ano, tukua ratou whakatikatika iti ngā me te whakamāramatanga o meta-raraunga mo te tuku (tau putanga, rā haaputuraa, etc). Na te raveraa i tenei mahi katoa i roto i te manga tuku, te whakawhanake peka Kei te whakawāteatia ki te farii i āhuatanga te nui i muri tuku [putanga].

Ko te momeniti matua ki te waihanga i tētahi hou manga tuku wana o whakawhanake Ko ka te whakawhanake Ko reira kua (tata) e whakaata ana i te āhua e hiahiatia ana o te hou tuku [putanga]. katoa āhuatanga kaitono mō te tuku ki te kia hanga me te whakaurua [hanumi] ki whakawhanake inaianei. kua āhuatanga anga putanga me tatari i muri heke mai tuku [putanga].

Ko te tika te timatanga o te manga tuku te muri tuku e tango i te tau putanga – e kore i te aroaro o. Tae noa ka, te whakawhanake peka huringa kitea ki te “tuku muri” [putanga muri], engari ko reira mārama mēnā tenei “putanga muri” pae hopea e 0.3 ranei 1.0, tae noa ki te manga tuku tīmata. tangohia ana tēnei whakatau te i te timatanga o manga tuku a kei te puritia ai e nga tikanga o te kaupapa i runga i Pūtangatanga [whakaaro ahau e kite e pā ana ki “Pūtangatanga pū“].

Te hanga i te peka tuku

te pānui manga E hanga ana ratou i te whakawhanake peka. hei tauira, mea e te putanga 1.1.5 Ko te reira i te putanga production nāianei, me te whai i te nui tuku haere mai. e te tūnga whakawhanake Ko reira wawe hoki te “putanga muri” [tuku muri] a faaoti tatou e e riro tenei te putanga 1.2 (i roto i te whakakapi o 1.1.6 ranei 2.0). ka, ramificamos tatou me tango tatou i te manga tuku he ingoa e whakaata ana i te tau putanga hou:

$ Hokona git -b tuku-1.2 whakawhanake
# Switched to a new branch "release-1.2"
$ ./puku-putanga.sh 1.2
# Kōnae whakarerekē pai te, putanga ascenceur ki 1.2.
$ e mahi ana git -he -m "Bumped version number to 1.2"
# [te tuku-1.2 74d9424] tau putanga ascenceur ki 1.2
# 1 ke kōnae, 1 kōkuhutanga(+), 1 mukunga(-)

I muri te hanga i te hou manga a uru reira, ascenceur matou te tau putanga. konei, bump-version.sh He he hōtuhi anga e taui etahi kōnae kape mahi ki whakaata i te putanga hou. (taea tenei, mārama, kia te huringa ā- – te mata, ko te taua etahi kōnae huri.) ka, Kei te hanga te reira e mahi ana o te tau putanga whakarerekētia.

tenei hou manga pea ki reira mo te wā e, tae noa ki te tuku Kei te pae hopea tukua. I roto i tenei wā, Ka taea te tono whakatikanga patu iro i roto i tenei manga (hei utu o whakawhanake peka). Ko te tua o te hou nui āhuatanga konei te tino rāhuitia. kia hanumi ratou [hanumi] i roto i whakawhanake e, na, tatari mo te nui i muri tuku.

I oti i te manga tuku

ka te manga tuku Ko reira rite ki te riro i te putanga tūturu, Me etahi mahi ki te kia whakamana. tuatahi, te manga tuku Kei te hanumi reira ki ariki (mai ia e mahi ana kahore ariki Ko te putanga hou i te whakamāramatanga, mahara). ka, e e mahi ana kahore ariki kia tohua te reira mo ngāwari tohutoro heke mai ki tenei hītori putanga. hopea, huringa i hanga roto i manga tuku Me ratou ki kia hanumi [hanumi] ano ki whakawhanake, kia e putanga Kei roto ano i mua nei enei whakatikanga patu iro.

Ko te rua kaupae tuatahi i roto i Git:

$ ariki Hokona git
# Kē ki te tupu 'ariki'
$ haere git --kahore-tuku ff-1.2
# Hanumi i hanga e recursive.
# (Whakarāpopototanga o ngā huringa)
$ tūtohu git -he 1.2

Ko te tuku Ko reira inaianei oti, ka whakaritea mō te tohutoro heke mai.

parau: taea hoki e koe te whakamahi i te haki -s -u ranei ki te haina tō tūtohu cryptographically.

Hei pupuri i te huringa i hanga i roto i manga tuku, Me matou ki te hurihia hoki ki a ratou whakawhanake. No Git:

$ Hokona git whakawhanake
# Whakawhiti ki te peka 'whakawhanake'
$ haere git --kahore-tuku ff-1.2
# Hanumi i hanga e recursive.
# (Whakarāpopototanga o ngā huringa)

Tenei taahiraa e arahi ki te pakanga hanumi (pea haere, kotahi huri tatou i te tau putanga). Ki te pera, hanga me te hanga e mahi ana.

inaianei, tino mutu tatou, te manga tuku kia nekehia atu te reira, mai kore tatou e hiahia i te reira:

$ peka git -d tuku-1.2
# tuku-1.2 peka Mukua (ko ff452fe).

manga whakatikawera

– Ka taea e koe te tupu [manga] i:
ariki
– whakauru ano te reira [hanumi] ano:
whakawhanake e ariki
– Te whakaingoa fakataha-lahi o manga:
hotfix- *

te manga whakatikawera He tino rite ki ratou manga tuku, Kei te tikanga ana hoki ratou ki te faaineine i te putanga production hou, ahakoa Kāore. whakatika ratou i te hiahia ki te mahi tonu i muri i te āhua e hiahiatia o te putanga production [i roto i te whakamahi]. A, no te puta he hapa nui i roto i te putanga production, Me whakatutuki te reira tonu, na kotahi peka whakatikawera Ka taea te ahu te reira i i te tūtohu e tohu te putanga production ngā i roto i manga ariki.

Ko te ngako Ko e te mahi o nga mema o te kapa (kahore whakawhanake peka) Ka taea e tonu, i te faaineine tetahi atu he ako tere o te kore i roto i te hanga.

Te hanga te peka whakatikawera

te manga whakatikawera E hanga ana ratou i te manga ariki. hei tauira, mana'o e te putanga 1.2 Ko reira te putanga o te tuku o te hanga rere o nāianei, me te he hakari raruraru e tika ana ki te hapa nui. huringa i roto i whakawhanake mahue i te iu tonu. ka taea tatou tupu kotahi peka whakatikawera ka timata ki te whakaoti i te raruraru:

$ Hokona git -b whakatikawera-1.2.1 ariki
# Switched to a new branch "hotfix-1.2.1"
$ ./puku-putanga.sh 1.2.1
# Kōnae whakarerekē pai te, putanga ascenceur ki 1.2.1.
$ e mahi ana git -he -m "Bumped version number to 1.2.1"
# [whakatikawera-1.2.1 41e61bb] tau putanga ascenceur ki 1.2.1
# 1 ke kōnae, 1 kōkuhutanga(+), 1 mukunga(-)

Kaua e wareware ki te huri i te tau putanga i muri i kouru!

ka, fakatonutonu te hapa, me te hanga i te e mahi ana ako i roto i te kotahi, neke atu rānei e mahi ana wehea.

$ e mahi ana git -m "Fixed severe production problem"
# [whakatikawera-1.2.1 abbe5d6] Pūmau raruraru production nui
# 5 ke kōnae, 32 kōkuhutanga(+), 17 mukunga(-)

Te whakaoti i te peka whakatikawera

ka oti, te bugfix Me koe ki te kia hanumi hoki ki ariki, engari Me hoki ki te kia whakaurua hoki ki roto ki whakawhanake, ki te whakarite kia te bugfix Kei te whakaurua hoki te reira i roto i te tuku i muri. Ko te tino rite ki te ara tenei manga tuku e oti ratou.

tuatahi, whakahou ariki e ra i te tuku [tirohia te raumati]:

$ ariki Hokona git
# Kē ki te tupu 'ariki'
$ haere git --kahore-whakatikawera ff-1.2.1
# Hanumi i hanga e recursive.
# (Whakarāpopototanga o ngā huringa)
$ tūtohu git -he 1.2.1

parau: taea hoki e koe te whakamahi i te haki -s -u ranei ki te haina tō tūtohu cryptographically.

ka, ngā te bugfix kahore whakawhanake hoki:

$ Hokona git whakawhanake
# Whakawhiti ki te peka 'whakawhanake'
$ haere git --kahore-whakatikawera ff-1.2.1
# Hanumi i hanga e recursive.
# (Whakarāpopototanga o ngā huringa)

Te okotahi anake ki te tikanga i konei ko e, ka i reira te mea he manga tuku tīmata, huringa ki whakatikawera Me ratou ki kia hanumi mo tenei manga tuku, hei utu o whakawhanake. hanumi bugfix kahore manga tuku ka meinga te bugfix kia hanumi i roto i whakawhanake hoki, ka te manga tuku kei te oti. (Ki te te mahi i roto i whakawhanake titau tonu tenei bugfix e kore e taea e ka tatari noa te manga tuku kei te oti, Ka taea e koe hanumi humarie bugfix hoki deveolp rawa.)

hopea, tango i te manga rangitahi:

$ peka git -d whakatikawera-1.2.1
# peka Mukua whakatikawera-1.2.1 (i abbe5d6).

whakarāpopototanga

Ahakoa kahore he mea tino faahiahia i roto i tenei tauira amaa, te ahua i te timatanga o te pou e taea e tino whai hua i roto i to tatou kaupapa. E whakaatu ana te reira i te tauira hinengaro ohie ki te mahino me taea mema o te rōpū ki te whakawhanake i te māramatanga noa o ngā tukanga kouru e tuku.

whakaratohia te putanga PDF o te ahua kounga teitei i roto i te pou rangitaki taketake: http://nvie.com/posts/a-successful-git-branching-model/ [ranei i runga i te hononga Tikiake raro]. Haere i mua, ka hoatu ai ki runga ki te taiepa mo te tohutoro tere i tetahi wa.

maha Tapeke o täia: 8922

He arotake i runga i “He tauira angitu o manga i roto i te Git

  1. Deivson Birth ka mea:

    ahiahi pai, e mohio ana ahau e i whakawhanakehia te tīmatanga Git mo Linux engari ka korero e pā ana mateā, fifili ahau, ki te rere i Git i runga i POSIX MSIS me matapihi??

Waiho i te Reply

Ka kore e whakaputaina tō wāhitau īmēra. Kua tohua ngā āpure e hiahiatia ana ki *