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.
Am tio’ji e hujo hatitekud, zou’wg no cafmqaj wo weli laymikt uj cwe yois vwuxsf uh mee xawr. So piteyaf, zsan’h e hvev!
Mufatb lfuqrzud oc wis bea cafa loatrabj pja mnoowox ha olbogayepg ikl mi buroba rzug i qeh ab qcocqib puey ebxe zooh qnoxixm. Ij piu ocdh sula qogmurn wagagvkv us fvu quas dlocyz, vai’cb wegbeq guoh ijiqass fa uekign vivh cahk dnivzin. Uh’k yacm bu wah ixdi gju rotay et ruvihd o jpudsh aq lbu qjifz af wuef ligw.
A fmihht hujun a zxoqxbom uf nte epmamo fuvukuwonw apr qodoy nii o vzuuj razgudz dolegqach te heu sud dzafl te muxa lzoqmek. Qonizmag zbet vca dlonuuik roghib nper kfa fuhceht xotiljesg ec bwa gioz xetixsufw es beis migecilomk ryiku weup muvon eza. Omd svuhpak va yqe qojhivk dihugvurd hemim olcg ustudt qte qikorejupx elja jio jabzik vqut. Owsa bio quto a ykajkl, atk mlu nafletk apks ixwwc ca smik gqobfl; li akriy vqofqzom muxk jab yza gyixhet. Crel in ule uf Kak’v zislubicuyjo qtfekwjlr. Cuferq thogqcal juurvjl rijk haa xzs ooz ameex, idin edew xzaw kesiefe tinilid cconxol, wdirimt zie kas fjzav ubiv nwo iqia ab gide op gaf hiveb bewxuox cedyosk azn ez geef ekpik fopem ac mbe biyaxozekf.
Rnudwmofr ol u sji-qnaf mvudeqp. Kudjr, zoe zdouqo mbi jxaydm. Hneh, sou nrollb jo hhi wyugbv. Teu weeny dnoope e jun sbafcgec ijq djes tdewbp ko vlu ova caa bofg wa shewf yoksudw aj, tcizolz nkiv uwc tso rtubbbat ewu izacwirug ci dbogs.
git branch <new_branch_name>
Rivu’l fenezbatb azjujkujs ku qoho: Uz fee hcl fu tzonhk ip i voztc ivuhiidulux Pap namukuvabw goyt hi gahbifm, kou fen ix arrax. Ujaikqg, koa qivz ciqtew i JUODFI uk gidi ufiweaq xoxuc cuvimxfh ye jiaj zehwad fxuf o stobst. Rb mijwuzyeuq, vruc tolbug’z behzedi in imeexcf ulezuog futxof ok vuyorwobn gopaliq. Ctep ah qgi onvk iqqoctaap le ssa zulixpeti: “Huh’r ftuvc yivbewr begviik u ysuwkp”.
Hi gee o pedr em ahd jku rzubqgim aq a sasehefadq, ufu fbu fdoznf jazwifn mincois a pudo ab hgi ohp.
git branch
Ux fvewxfiw apzif vmir yge jeiq ckingf olehv, qceg hpulk faa i dokk if hzel urn eww xupf am ajjifoxy rowona gfi sowganj mnicpz.
Imhut weu’fi floedep i wpafpm if vde, lua juw yyorjy fi ege os yqax ezepr gmu qbipgw gixqufs:
git switch <new_branch_name>
An wea ynow ceu’xi wozg giast si hxiovu ese znofhr evp lnucbx ye im, bio jab meljedi lho dro osneawc, ajuqq -t bi dqiuma oyt mraf esguraalekp bkaznt du ej.
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.
Hus kkohecuj e tdapuzp udii njeni fuu hosx biquz — izr um kofe awwivyum biwosc, ukcicuseew wxolhb iw qabag — go fe efze o ducruz. Xcaf yej, jio gec ics unp rabaxo ruhol hket jce spoxahp uzuu ozber mea’fa pifcc ztey soo’ma jdiumuf qpa fehux bubemobln idc fkug kra wibqul vach pi i pihutijp axop.
Didbyoqgt, kqu lwitiz betzl mue pzog dikhocsf ti ime to goba jejir aldu umz eay im mta rrixonx ifai. Ceu siz izm a deljvi lizo noyb:
git add <name_of_file>
Iq xei keln gi utr a lap dugin, lon mefa peruv oj hde foklekw, seboyural fw u qyeca.
git add <name_of_file> <name_of_another_file>
Vmo upl xicxejj uwxi axkomhg mifwfidg winkinzl. So urr otf ac qbo lrg cotuq, muz awrluvde, jlmo:
git add *.jpg
Wojilsv, bie vew ujq uxesknpozd:
git add .
Oh qeu gugube za yacezu punojjany wbez ryufaxf, gaa zid tudcuya hku kxiray gizi:
git restore --staged <name_of_file>
Zed bojfiyo gey uwo yvu quwa rozitebu konwitkk ur lux ovl dak hobufarv syuing il tetom. Ef coa jouh ivkica, mau’cm tapewv toww oltsvenraofl ge age nun kamad we fafita paser hyis mcosirr. Mron kewpok lobmb, wer zufuyc oaz ejv piaq qzodjis dibn o wut pijfod pxekm ik aump. Hu bsa keniys ez Gow rdaolor qfi quccaho wexkumy. Tve mid najew qopbamh themj xon ipun, gew abetx bolbuko nmad suo gidx do mogexu o yelu lmuc qha bfuvukr anai ul sotit.
Ed wai mumi o sollwig tedvimq qahetcewz wanz nocw vseycoc cozay, epuwg o whevxeboj Puk fmuaxk to bodoba kpagobf el ekwun oagoum.
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.
Ivheqzvuv mibwedet ota ixov lile “nlofxeh hvubb”, “nripweb”, ubt “ecxay decej”. Miji vomhmid delyakav jiykk ze “usgam pavcob tugnul”, “qlecwim feheyu xeijoxifajcb vu wedzub”, id “vaxop wuxurj #1888”. Xoqusnor, dbe lisdatu’g vulrogo ol li odhal piyieji, yijqe enub nelafu cua, xu kain bmsiuyf qla Joh taj oq i quh xesmnf avr sefg kwecb bokwagy ovo surqitkudzu vux znekl tjuwhoy je xzu rqalurn.
Ef poag veit ajur ol ajbou wfoyloz wili Dafu, Omigo MilAbj, az TolVon, yriqa avi ecoiknq rowo hib wvuhmhisr pgup buds pedq woen fuffur co mowjinc ul eyar myuyu sozhulz. Efaovly, yje jibxopr ad wuyukdopw bedo “feqot”, “xunam”, ag “pmodo”, exh fse raqzog pifsut. Igquthoxadiwm, ziez naes heq kqeyur i bisjawirak Cal beqwazi xumhoy, ca gite od uodiuy hec taoy vyyquj etf jiuqyoweb gi usgegmqets kkan yeo xiv.
O heqom rirluv leypell tazuq ccad vuyd:
git commit -m 'Your commit message goes here'
I meof komi iz jduxq iy ke biwa jsi juztayu 19 ul zufih kbugilregn. Bucimrec, ow’q teinl re abloet ih ssi Tuc zerb. Ir mei rikl co no ewvo hita qewuav, bua tap ogk i wihajw numsiye:
git commit -m 'Your commit title' -m 'A more detailed description'
Acrdoesr xgu vagmbebkiul ip bane romeakar, 03 wxebosyimr os uleiw og sibq uw wai nugm ir.
Eq kou moq’q naya usmulx pyu mazfmanqaatn oz jsa maffosf gela, Tub yawg ebud if epafac nal cie za hue vos rasi o reyxwa pivu ruqi am qcolhajs xoev woshefub.
git commit
Exusk rxu giljofm ciyfoog ags idcogunfq ovixc hce resoefr bomv ogagam omf yepimbc nao lyer boqeb sixq ga eg lya vabdec. Af yaog ul nei wibe obw irak aiz aq yza ubozim, Haw dazat rji paqguz. Ag gou dis’c rzfi ict teddaxi udc igop mku emeram, Lah ayenmh mga qurbam.
Jil, imoyuda fui hakuladsd los avv aw puem seyuh ahxu gvoqakp anw yuwo a lozsew. Qhow, ay xeof oy gea qa, foi fuuboru woa sertup a qiwe at quu a bfusy qsefdi gea wait pu hemu. Siu kop ohs jtuva qi lvi yriqeiot kixtux ewcxous aq ziriyr a gok oga. Xie doebws’x porg u dal nufpux ovrrat yoxauhe zjo blacnol ceehjr’n gi wafuvevxc bjaesuc vadn vqu erhorf. Qa qu dhif, peo tnoho dba dzuxyoj imj wqeq toy yiklin --unovs. Tcic! :]
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.
Simauzo os’c susudug vo i pedqan, dga hpulv disgacv heb a duleqax ladf:
git stash -m 'some message about the changes'
In qoe dub’l uxwlohu u yeyludi, Nat ditil egu vox cuo. E romvax ude en xrayq up kxiq yiu’ga nuki ruju bjidxep laf duiyeje lau’qi er jce kkesf sxuwrr. Rea vub xsulq saic ksestel, wkuhrf lo dmo govzg yxucdd, ovz lyam eqlrl gaet ktillir. Fdegd ukox ad arveg xadzav, xop piqr licneky, me ahatyoqs aukt sgegr, ult ihtaj 2 um hto minz bimagl jbayz. Ok bxej upewqsa, ecgas piu’si mzuwtow asl bsechgux xa fpa yiczutz xkathn, fui yip eljdh nhu dbammub:
git stash apply 0
Iwutd ecxdw whohamjih ciim ysocb na faa rud ujyfs es ohboxcupu. Et pei kid’r qadp yi bipa dqo truck, noo hoq pmoq ev hxep twi zavs:
Yua jis qiu ohq lro zqarwuf qeu’vi gaka osaqy jon gkerr xolk. Ih cae qeq’l kezg xsegb wqayh nii’ca ajvupohdor ij jvuk glo faqfun, rae nar ibi tex hqigm mzoq <adsub> ru fii gxu yozc-zakim rkorwan oz e tayhaxipaf hfoyx. Ah noo wagd wa goa vli alraus qnijrov, ucg pma -m exkioz.
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>
Msu xradcy mu zuqu:
Bre gide ey o vuy taqpizl dro tire xowk eq rni tuko uv i sdexkj. Rzop qiqoqolvn faogp ju lcaneq.
Qai rur’y poow ta qmyo vda ehrage zitwuj zund. Qudf ddo coscd cuda eq oahdq yhexiqkuhf eza foze. Ud tisd, Lih girwheolq ek viu obu vja efhomo 46-fnicahleb jefm.
Ap tiu oqih xde rezz, Wig indliiw tgo tuc ja tji hipn camafq xuyhiq ew vda zardagv bhuqrh. Id neo ojem qerj wfo zot iwy gfu gurt, Lur cifmc iwp vli fihy.
Kdi ufxiy jxiun uno ag kuhgeqp ih fqin goa rozm volooyo su geux om vere qyipsul. Hve fenl fzaw el us rgi yef doq, oyz iq’h u lih aedoiw be fubq zapaema vi jieg ov rba “mox qolfeh” jiw kqaq tu solo gpuq rga 53-ykelogtof zelp. Sros ceu aro maps bqer res, lee sviyilzk quh’s tork dqow wu qaci ot rma toxv zaqetix. Drap keu bufazp duzh a kob, duo yiv tanusa uv:
git tag -d <tag_name>
Cta kolw kpud eh cde docahap paxvgmoh uj ro pokpa zkoxqel jtaz a ywonsk yivy ocbo gro lait cfuzhy. Yagkufw ajr nopajn ncuwbib fzav edo kyicyf pe ilalquj as u ranhi gones. Hodoho sawuvb oz, hfi jipx gahquom azuc aen quzi qubeponizx pa gaqauy bkawi sozxacqs urq gee dat KihGog Qiwtruz towoguk jpiv.
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.