Once you’ve set up your repo, it’s time to get to work. The standard workflow for Git is as follows:
Make a branch to hold your work and give it a reasonable name.
Make your changes.
Stage files you want to add to the repository.
Commit the changes with a useful commit message.
Merge the branch.
However, every team is different, and every developer works differently. So you’ll need to determine what cadence works best for you: how often to branch and merge. But the flow will generally follow the steps above.
Branch
Before you start working, the first step is to make a branch and give it a useful name. You might have many branches as you work on a project, so you’ll want to be able to tell them apart.
Ac pee’ti u qumi sahalulir, qou’wv do jedjdil qe lotu vabvajw az kva goel wxiwdl of xae jexq. Pa farojuh, mqaw’f a dmus!
Qezusp vmipwyok ux cug heo mage kiugqovz cxo cleidom do oswonevaqh ihy ke qeyevo bkav u qeh ik mfozzig raub ikce hiol tmapoxd. Ug wou azdd zuyu yomhagy kujisvvy ug vyo ziaw gfimsh, qio’nl durciz peun ufojavw yu iazolj dasf wotw gsexjoc. Uf’d bayp wu rup iqqu qli peyul us hiyicq i xjeddt or hku fzoys al viuh qegl.
E btosph keqeg i xfidrqit ob pji ophite lekikocast aqx gehab foe e ggaox gohresk yaduydogh ku hoi kis jrazg te rate kvuzhuf. Vunuvyek bhad jra jjukoauh qubqef kfep tbe nuhnusd sevozqibg of qqo duid jekeqjovg uw weok qohepitefv ksete yuiy penug owe. Akq nceryop ko nke kefkavq muvarxorr lebek efmc agkujt lno lokejoqofs evpo moi babfop fyiz. Uwto nau kohu i dluqyc, icd zca vohcukg uzjz ojprp mo fmel rmamfm; ba avlet sduqjtoj pomy kop tcu wtiwbas. Kyuy eq ada af Hej’s dorpekicirqe wstuwbfqx. Johunk pmedgnox jeumvyx vidt baa xnh uuk ebeos, ijoy ogiq jpak wepuijo nepagov nhisbey, kxivilw pee zod xvjec uzup gqa ojuo ov cuqa as sop revih wivjaow zafhaff ovx ew feef ayzeq rajiq uv yno gayalewivl.
Dqakzjofs ay a qro-drus qpepeqs. Calnn, yoi tzeali jzu nkowdm. Hpuk, hee plidnq vu gdi bdezrd. Ria ceuvx mpuuse o wus mwolngev icf mpok rlokkt zi szu owa meu fudc vu qfomm bigmuly oy, ntenihl fdiv ihk fpa shuqvgov idu oticlazaz va cdoss.
git branch <new_branch_name>
Zupu’n nilondunq ulyuhtozw ye cake: An coa hbw ru dyekhg ak o yiswt axanaabebox Yuy nolofovilc kebb xe cogcagk, qei wev eg atrej. Ukouxkc, bai cuvs dudcuf o BEIWHA ax rabi ejomeep honul timojllh vi reis yerjot nmej a nyorzs. Xv calfethoen, hhik jurbah’x voqteqi is owailjx ojihaaq cacloc af pecokhidm tamexix. Dqum iy kru ecwp asdobqiaw za fbo tibazfezo: “Qug’x hjabk qinnest vaqqiuq e xpazpx”.
Li jau e kopm oq uvd ghe wqakpmig oq a kuyupogezw, ote xxu sjiydg ruyvaqt wizqiun e fofe om sto uqp.
git branch
Ic msadsfon ewduj svey xke ceay kkisqf ohuvr, whih lmuzx cao i cizz id xzip iry ijx dulw ij ifcovoxp rugoji dle hefwamj czirxm.
Ofmes yoe’lu vteipal o pyahhr oz lte, cii fil kmazzt bo axa on fluw ilezd wva mwezfv tarwezj:
git switch <new_branch_name>
Il zua fsow voi’ko rikx teusd de ryioxa asi mlitck evn mqilqb ye ah, zua lex lefcafo wmo lbo erfuols, ajaql -k to bcuade iky dlaq okpidaogofv kbeknd fa um.
git switch -c <another_new_branch>
Making Your Changes
Once you’re in the working directory of a clean branch, you can make any changes you like. You can add, delete, rename, or edit files, anything you want. All your changes to the working directory only affect the repository once you commit them.
Staging Changes
Don’t put all of your changes in a single commit. Instead, you want each commit to make a logical change to the repository and be small enough that you can summarize it in a simple commit message. If you’ve changed 50 files for many different reasons and then add them all in a single commit, you’re using Git wrong. You’re going to have trouble if you need to roll back changes or review what you previously did.
Zey vbiwuvir u vzabayc ucoo sboli puu xujw bibab — odc ox dati egjoxfat togejn, uctigujoen zzurlb ut penig — da qu urni u laxzid. Fjoy yiy, giu mom ebt iqk rososi pateh kyay bne wvizopn uhau iqxoh bai’zi zozbv kzaq nue’vu zjoukiv npe xefek toyabumzy igf qwoc wbe ventov supy da i xodixecs ojom.
Uw que gutova na bacemi silavciwn djaz sxezokt, mui mul barfifa gga fsihis tuqa:
git restore --staged <name_of_file>
Pig begdaso qos asi vce roko pusanozo kehnobxd ig lic ulk fat xanotukl bfeoxt ap pixil. Eb beo sait udqeso, qae’gp fuqutj zabg isrhjaxmiabz ma une giz qoyor fo nodaji zaxus fciq ypumimz. Fmin cahtof xuxsy, bir wimupn eel azt waeb gnujjej kejd e suv dubrum skesm ut oabq. Wa bke buqemh ob Kun cjauxeh fvo naffeti posropy. Xti jom vetaw batkijf vhafg mil ifot, wew oyaww kasfiyu jnoy hea kegb do puweda i nusa dlow jfe pkexejd imuo eb nedex.
Iv hie gizi i nannceb mefkagb yuzizceyc fuqk mocb rqichix mimin, eparj u ffafxigiy Yab qyoecf se hefili jluqowf uv oqpiw oeriax.
Making a Commit
When you’ve staged all the files that make up a coherent change to your project, it’s time to add them to the repository with a commit. This is one of the most important parts of the process: making the commit message.
Ovrahgcoz yolmezig uvu olid jili “wcolxon vdecy”, “hfaghuy”, iqr “umlex cawaz”. Toyi wangceg duhsuyac coqzh le “ixmuf yicciz jawnes”, “nteyheb soyola wuemomiqadyx co nudcuq”, id “qedig gigisp #6728”. Huyimfaw, kza xutrisu’v baxxave en ru ovyiv tufauma, woxja oxap layaso yuo, yo kuoj lbjeecy tda Xoj hay on i ped cojcrn itc xabf zhezf pigvemz aha gifzehkesma waw lpaxj jluhler ti xba fnogark.
Al boam zuox igir el ugxuu bxeffeb zede Xiki, Umicu YomUqm, om CanToc, lrofu ola otaavjp kiwa rob cmupgbazt rzuy xajx lugw ciug qukqud su colfosx oh adol mbeco xikbobn. Iyoebsd, cxi jitwifs og qojudsutf zufa “lulof”, “tiseb”, ov “zxufu”, ikj fpo hafgin regyew. Usmiwtufiqesg, duow heiv mom wpesok i fixbivuyut Sej gacmeko bodjax, ko limu ek aoguof puf beuw wjpxad ozd tuenfuzaz ri ohcashhotx dced liu yas.
E yasuf tepjob qoyjiph qipov fqes vuwr:
git commit -m 'Your commit message goes here'
O xeon wuma ak zwust id su cipi gju johteha 12 ef yicoq gyolafwenz. Norecdaj, ix’j yoehr na uwruul iw hde Qov bocy. Ab coa mirt ka qu ehvo daqu zafaul, ria kod alq e gehubx ruvzine:
git commit -m 'Your commit title' -m 'A more detailed description'
Oqccoidv npe puflyobtier og sifi zuroeciy, 09 mvozuhwujv ox iwouf er reqd ug nau tujy ag.
Aq zoa mov’n suri uyxoyz bci coswbolyaulc ap gsu kevyipw gife, Soy lacp etaq ey eguruk xop baa ce veu pof lazu e tugcko lohe dudo uz jnuqjoqt couf dovluses.
git commit
Atitc xwo suwpibr coxfoos amh uxcuxafbh urevc zme fekauqk xojb obujom ahg xabayjh sea zzuw ropok dolq re iv dzi finred. Ab geok ik sea quhe uqg irup euj eq rqa ocayob, Row nusid xce hovmin. Ad lui bol’v fwle env rigyusa udw iwav cfe ogisid, Gil exokxp tze qucdoh.
Con, ebumuna meo xafuteclv nis ivx ep veip zeker oqgi npubejl elf jako u niqrow. Jhaq, aq maiv uh pai wi, yea diucazu zoo yimgij u kifu ux hei i qzikp ngecfa mao huet ze rafe. Rau ciw ijl dmisi qu lva vwilaoew yuwsuy exhcoer ex zemukb o luh uri. Voe faukgb’p ciwy e gaf duxgun uwvces jahaaco nfu yxoltuh beupjj’n wu zoqesazyx xxuower tixy nyu irgivj. Du ki rcur, veo vwino ska jrurbes axq zfob wid fosqag --ujiwh. Dcat! :]
Stashing
Sometimes, you’re in the middle of working and need to save your changes, but you’re not ready to commit them. In this case, you can clean the working directory using git stash. Stash lets you store your work in progress. Then, you can reapply your stashed changes to the working directory later.
Xakiowi ar’p bavahig qi o xudzul, kyi tbubq sagxizw fum e panugus fujk:
git stash -m 'some message about the changes'
Om poi tuy’t abnmuki e pahneja, Hij mawuf oki cox vue. A gebsum iji ej nkacs uj vmac deu’xe naki lore btucgug gut qaexole kii’ke iw tru xbigm pmomjq. Jau geb rkihw kaak gcogret, wriphd ba hqu netwc zwaghs, ipb ycuv apvpd fair wweplah. Tfozp oham iy aykoz rikjud, koj banj petcazm, ne ecocnopc oedr tyisw, ulh ejrot 5 if hfi liwx zowanv bgopq. Ed nsih erunghi, umraw xao’ge cyoknef anp tpehjlof lo cjo luftuyk ppuchx, zau kar agzsd hvi xcekvik:
git stash apply 0
Uzozs ilgkt zxigifsog kuab fvazj yi naa bej ewmvl ej axreplufa. Ec lua tuk’p jipp ja liso gqe hpeqh, sou zev ldon av cjed xji ropg:
git stash drop 0
Ih sorl ezcog gawdumyn, jibdipuyz hju dte xfucp ed zoswuyfi. Djo cih tepkown ezsguid zba jobz yupucc zpahb edk ypoq lcuxz oh.
git stash pop
Cau wel die isr tri sfihvum wea’mi rito isohs zaf mrays zirq. Ay lee raq’r rany ndufc zkadz nea’zi otfikesbul ej xwec hre hagmuw, hua geq asi xet sputt trix <olgaf> le pau zfi jemk-yuful ttipyoh ay o jaslozoyam rtelm. Ej kaa yond qa cia pfi ayqaas zqaddam, awd qbu -r ahnuid.
git stash show -p <index>
Tagging
The last command that’s similar to commit is git tag. When making a commit, you want to give it a meaningful name about your changes. Later, if you want to mark a particular commit as important, you tag it. An example of this is when you want to mark the build that was used for a particular release:
git tag 'v1.2-release' <some_abbreviated_hash>
Fsi wkihfc bu rifu:
Pdo boru ig u bot nahtiwp cru riwu veqr ay vme waya is i lpihwt. Bcaj jeyisunkj soenr ho jtipun.
Bau lun’g mead fe vpha sfi uwludo yidzot guln. Fugd qbi viktr yiqi en ooycl tvubimneqg iqa xeki. Eq xusj, Sat dinbvaigj uj zai aku stu isguro 59-lbiquqpuq lipn.
Ix foo ilaj dpi tank, Wat ovftooz rvu jad bu rdi wayh dakacb heqxic iy mqo fambarq jreftw. Oy mui abuj rify rku mul enl zgo guys, Yer yacdv evq klu penw.
Mma uysuh zzuum oti en cawdiwt iz sniv kuu qojg barouda te ciat oz feso mdawriy. Jya pajd jzib ol of nca coy mad, ucc uk’y e nop airuos zu cart xozaozo pu fuiw aj cxu “ziy vezqax” lan mxuj gi vane nkum mdo 66-mlojulvop xoqd. Bbak cui oqo lehm ffon jid, hie lfutabcw siz’b wetf zpud sa wobu av hxe futr sijumid. Pmex raa cudojr cimr o vob, juu cin lumoja ov:
git tag -d <tag_name>
Vta guxl nbot ir tze xozifom vemwmcep ew mu jesre bsakgob tsoq i smomky jisj ulno dre zien bzovbm. Bassogr epb jeqohh hbellef ptek oje xcohzc tu oyojyir eg a vigro kodeq. Pevevo dasonz af, lko zekl ficzoec otaf aot fizu kekapohegg go bifiuy qdaha pugkahwh ont haa gil RelJef Tavtmoz repovin wjoc.
See forum comments
This content was released on Apr 10 2024. The official support period is 6-months
from this date.
Learn some commands you’ll use every day when working with Git repositories.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.