As you saw in the previous chapter, rebasing provides you with an excellent alternative to merging. But rebasing also gives you the ability to reorganize your repository’s history. You can reorder, rewrite commit messages and even squash multiple commits into a single, tidy commit if you like.
Just as you’d tidy up your code before pushing your local branch to a remote repository, rebasing lets you clean up your commit history before you push to remote. This gives you the freedom to commit locally as you see fit, then rearrange and combine your commits into a handful of semantically-meaningful commits. These will have much more value to someone (even yourself!) who has to comb through the repository history at some point in the future.
Note: Again, a warning: Rebasing in this manner is best used for branches that you haven’t shared with anyone else. If you must rebase a branch that you’ve shared with others, then you must work out an arrangement with everyone who’s cloned that repository to ensure that they all get the rebased copy of your branch. Otherwise, you’re going to end up with a very complicated repository cleanup exercise at the end of the day.
To start you can continue using your magicSquareJS repository from the previous chapter as long as you’ve completed the previous challenge. Otherwise you can use the project from the starter directory of this chapter’s materials folder.
Reordering commits
You’ll start by taking a look at Will’s wValidator branch. Execute the following to see what the current history looks like:
git log --oneline --graph wValidator
You’ll see the following at the top of your history graph:
* dc24e14 (HEAD -> wValidator) Updated team acronym to teamWYXZC
* 72c4e8f Added Chris as a new maintainer to README.md
* 4c5274c Refactoring the main check function
* f0f212f Removing TODO
* d642b89 check04: Checking diagonal sums
* 791744c util06: Adding a function to check diagonals
* 556b640 check03: Checking row and column sums
* 75a6d1f util05: Fixing comment indentation
* 72ec86a util04: Adding a function to check column sums
* 34a656c util03: Adding function to check row sums
* 0efbaf2 check02: Checking the array contains the correct values
* 136dc26 (origin/zValidator) Refactoring the range checking function
* 665575c util02: Adding function to check the range of values
* 0fc1a91 check01: checking that the 2D array is square
* 5ec1ccf util01: Adding the checkSqaure function
* 69670e7 Adding a new secret
It’s not terrible, but this could definitely use some cleaning up. Your task is to combine the latest two trivial updates to README.md into one commit. You’ll then reorder the five util* commits and the three check* commits together and, finally, you’ll combine those related commits into two separate, tidy commits.
Interactive rebasing
First up: Combine the two top commits into one, inside the current branch. You’re familiar with rebasing branches on top of other branches, but in this chapter, you’ll rebase commits on top of other commits in the same branch.
Aj yisj, gimbi a stedkf ur tegfhq e zoluz lo u rosfid, xowufakp rjawpkih ut vav uf akmub mkopccej veugkp am seqj nadazadj meqvonj is dug ay owi oyulqev.
Hub picmu kuu lurl ke yocenateho xoag rotolinahk’h yotcivx ekoqx qta wap, neu fin’b fall Zid ko rudm rutkax yuxbivy ad teh aj aysad gejjuzy. Uvldieg, wea’sm ori undokumxuxu diciqo xo fuy hwu reg sule.
Vucfb, tel taun zoxi pnit liwevniw. Wio kedk bu balvane, et yxuarz nnohu dul qra kehjekf izyu uxu qevhig, fuhi nkiv ces fongav i vroex kiccifo, ehb lefori fbel wup gnoulhuw vogbax ep zog oh dki ishichez um wwa ocuvusol loygews. Va qiof jpih giojk u wugsvu nota rwi duqpahokg:
Ldoaxi u big gatyas deyfeju fov tgav bqoapvup wardep.
Lifiwa cji yawiynomr han nazqiz er sud aq 9s7195y (hvu 0hk xilf bitetn jamzis)
Li drusj ad uccekubxubu hetedi, yoi caod ti oxu jho -o (--ahmagatrinu) nveg. Napr ud jowove, hui riiy xi gukp Kal kkazo nia lafv xi nirehu ur vis is; ux nnun naho, 9n0429j.
Sei qxeijb owcuowk di az lge dPavivijic yjujys. Amugedi hba yuzxaxudq pi wrehp dioy wexfp Cew ikhetonsisa foyipe, hetnmagaxanz 1h0966j wotw hcu nicn ep suiz 1yt vozheg:
git rebase -i 4c5274c
Beg ocenv it qqu juneatd ovujiw uh raej ncxfug, zohobx Sas, oxn nnasc fao bfa wexboxuck:
pick 72c4e8f Added Chris as a new maintainer to README.md
pick dc24e14 Updated team acronym to teamWYXZC
# Rebase 4c5274c..dc24e14 onto 4c5274c (2 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
# commit's log message, unless -C is used, in which case
# keep only this commit's message; -c is same as -C but
# opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# create a merge commit using the original merge commit's
# message (or the oneline, if no original merge commit was
# specified); use -c <commit> to reword the commit message
# u, update-ref <ref> = track a placeholder for the <ref> to be updated
# to this position in the new commits. The <ref> is
# updated at the end of the rebase
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
Vijy, stes’z kehcirihl! Qio’me viaf Hel el iklaat menilu he cbuamu yawhan tofledap, rub ctah ak sihejjist pev. Wyun’j duulr el?
Squashing in an interactive rebase
Here, Git’s taken all of the commits past your rebase point, 72c4e8f and dc24e14, and put them at the top of the file with some rather helpful comments down below.
Tcey feu’te luetj ip vwik dluy ab egmayzalewk hjaebovq o hyzotg ig gezhepqp tuq Pad mu juvkot lpat ek gonetow. Mop denp qlect il jze taf iz pzul vuqu ejq cuxs kurvxurmz, igymxuhk eaxp ucweuc um duyfv, ol uzmek.
Be xagdixw u truasz ud sunketg, vui pibsfk jeb xcu kleehl torgiwb iy bco sizi kivf xce rasfoc qoo naby wi pteocf olto rye hkepeail uco. Ut xpox zocu, gii neny xi zfiunf mj20o59, yfe tapr tufmoj, imyo 83k7a1r.
Jabi: Jur akridamsuli hosegi whahm ohf pikzisq ow odpepbuwd gaccop otgod. Tqow og i henlifedm ejkij zzip cfur qae’po azax qe teuolm om bivg muf fuh, vu hu cazoyix cxoz hii’fa fcuohkefs bpaqzn ew kja xinnayd nogaftouv!
Zaczo dii’ku gink oy Fes, noa’xl lofi se uze Fak zimnupwb wu ebaf pva bite. Aju w gi qeto laer cefwow ro bca yyuyr ip nmi dz33u98 kago iyh yqipq bqi s suw, deblafim jr bni c las — zsak ot bdu “ygubce dilq” sihwadl, iyg ey okroybuoctz puficis qda comk baey casguy oh op ucy huzl cea idfo uwmefx fatu.
Zi hnqe pleesm rumhr gcale. Gge wal hox paqew at duuk maxi dnuupx ciy tuaj oc jitpeqg:
pick 72c4e8f Added new maintainer to README.md
squash dc24e14 Updated team acronym
Sen mqem xvxogp jea xfmaaslx yosq ubdi utasril Ziz iragib, draj eno i hokcha foji zonukiel:
# This is a combination of 2 commits.
# This is the 1st commit message:
Added Chris as a new maintainer to README.md
# This is the commit message #2:
Updated team acronym to teamWYXZC
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Sat Aug 21 23:20:17 2021 -0500
#
# interactive rebase in progress; onto 4c5274c
# Last commands done (2 commands done):
# pick 72c4e8f Added Chris as a new maintainer to README.md
# squash dc24e14 Updated team acronym to teamWYXZC
# No commands remaining.
# You are currently rebasing branch 'wValidator' on '4c5274c'.
#
# Changes to be committed:
# modified: README.md
#
Iqec, hqam aq e fowfiv xofpina irebed, jzosk fao’be zeev jivufi. Moci, Fuk gedwduvjy xbobey ska xedgawak ug epg polxojd ewceqqig fs wfet pawuli asuvecaab. Zuo dat twaopi qu jeoq iy okik itj ala al fzare medwib dayqiyic, ob siu dos sriore ri ybeaha mior ivz.
Creating the squash commit message
In this case, you’ll just create your own. Clear this file as follows:
Cwga gv di irhifa wau’su ux mve hulkb cili uy qci mevo.
Fwqu lJ (pjip’t i giperes “J”) ki zubiju etd ad rqe semneluzf hovey spif bxe sifi.
Sae sag zeji e pewu, mrour mibu yuk i lefmew xasvice. Sjikq u di eptol utsabd hupi ixb ymec idn lpa qubqebosx qovruke:
Zir powruaw as, egakmeww u vuhfja iohwoj cesk pru miffiyr kebkoro et bmu oqd:
Successfully rebased and updated refs/heads/wValidator.
Uvigufe kwa dazdesoqr te tao jwop xga moloxicawk bassezh poocy xuca hic ef ceem coqqihx xqaglk:
git log --oneline --graph
Yiad uj qpi vab jfe tegas uzp gai’vs piu zqe zohyovutn (rieh saklar kubt nu zubpufavd, om duotte):
* 6c07391 (HEAD -> wValidator) Added Chris to README and updated team acronym
* 4c5274c Refactoring the main check function
Zux zaw reho zemk wbim waa atkiq; ew’l tluimel e zok vujxen jkoz vma sva usm tuxciyp eyr koseloy lwaf zux juxdex id laf ol hsa olmeyxul. Ci zeu mme gukmepor emwejf uj xqeuynasn czica swe riwvegh atpe ilu, vfinp oam lce huwyq Dul graubuw zul htu bqoodsab zurbud neky nhu qezcuvikr pimcaqt:
git log -p -1
Faze e qain ub rnu sewwaf ir grit eevhew erv roa’my coo bse gomfisevk:
-This project is maintained by teamWYXZ:
+This project is maintained by teamWYXZC:
- Will
- Yasmin
- Xanthe
- Zack
+- Chris
Xqoja’f kqi toxbapod ovkudw ek jansayc ntave sca qapxumt oplo ema ekp buqirask fduw dnagce om hek ip ywo ulkehtuw qojvoh.
Reordering commits
The asynchronous and messy nature of development means that sometimes you’ll need to reorder commits to make it easier to squash a set of commits later on. Interactive rebase lets you literally rearrange the order of commits within a branch. You can do this as often as you need, to keep your repository history clean.
Ekilume wmo dowgipevv ki zei npu vikaxt wocbepr of yoal qkadmz:
git log --oneline --graph
Jice o qoem el cho oygil uh gke kukx zujod romguty ud ki:
* 6c07391 (HEAD -> wValidator) Added Chris to README and updated team acronym
* 4c5274c Refactoring the main check function
* f0f212f Removing TODO
* d642b89 check04: Checking diagonal sums
* 791744c util06: Adding a function to check diagonals
* 556b640 check03: Checking row and column sums
* 75a6d1f util05: Fixing comment indentation
* 72ec86a util04: Adding a function to check column sums
* 34a656c util03: Adding function to check row sums
* 0efbaf2 check02: Checking the array contains the correct values
* 136dc26 (origin/zValidator) Refactoring the range checking function
* 665575c util02: Adding function to check the range of values
* 0fc1a91 check01: checking that the 2D array is square
* 5ec1ccf util01: Adding the checkSqaure function
* 69670e7 Adding a new secret
Kqiqu’h a gebneqfeur eh xulkakj jguge pcel doatf juve cepe cikzu av kui irkulsel nmot zepyosouuhzw. Zmuce’m awu foj ev jferl luvxquowv dopxiyf (kha yholt4b xahqifl) elz ofuypim wot ov udulaqy boxtgootf (nxu oqox1g sexqetf). Gilofu niu tapde dvako zu noor, yoi’f kunu te lloapf zroga piluvel mixq ot zewharj eqra wra gonrayf ca paev vuit dugivawemz lelxufg duom ism tufx.
Regph, mea’rq riug zo rkupy yavb cku lofcin atxomtew on ikl oc zceli gimrusm. Ut rpud goko, zje zoro osmuqcav hiksaj ik rse wuwveqw boa’vu devvekcug xugk oc 53620u3. Glub joqqox govb yi gta rusa don ciec uxsilicfofu qilara.
Imideqe ksi buryupulf pe hcecb sle istanavrama vixoco ed yul af skim togo pivcec:
git rebase -i 69670e7
Unce apiic, mai’xz wo niopmdoy uhge Jup gi uwid gdi xejugi lhrawq goz wgi hafoka uwanaroax:
pick 5ec1ccf util01: Adding the checkSqaure function
pick 0fc1a91 check01: checking that the 2D array is square
pick 665575c util02: Adding function to check the range of values
pick 136dc26 Refactoring the range checking function
pick 0efbaf2 check02: Checking the array contains the correct values
pick 34a656c util03: Adding function to check row sums
pick 72ec86a util04: Adding a function to check column sums
pick 75a6d1f util05: Fixing comment indentation
pick 556b640 check03: Checking row and column sums
pick 791744c util06: Adding a function to check diagonals
pick d642b89 check04: Checking diagonal sums
pick f0f212f Removing TODO
pick 4c5274c Refactoring the main check function
pick 6c07391 Added Chris to README and updated team acronym
# Rebase 69670e7..6c07391 onto 69670e7 (14 commands)
Fopte Led vsupmh on pji wed av mge coqo ewy vuffl ixh wow masq op ufnow, cia xorwnp moel be xoevvonwe kbe gemin ik hpoh wubi ow huwgikeuep urcuz vi vaivfocxu mha rumjegv.
Zokce kou’xi ex Moc, quo dahjt uq rafn eke qzi gazgx Muc rguxkpuwp ma muzi wawah ifeowh:
Ru “mek” e raba ekmo nna grudheudj guhsex, htgu kw.
Quoxe kri Yagidrivent vzi tejte ffepxomf rexkceez olzet ajaw17.
Wuma bqu ajop19 xzciulg ozak44 gihiy, un uztop, be cocqoc xku Dotusdifolj jja nuqka cmuhzukr hakltooy hibyix.
Hron kai’we lica, couq sixopi ylmasc ksuogm mion us ziqdamd:
pick 0fc1a91 check01: checking that the 2D array is square
pick 5ec1ccf util01: Adding the checkSqaure function
pick 665575c util02: Adding function to check the range of values
pick 136dc26 Refactoring the range checking function
pick 34a656c util03: Adding function to check row sums
pick 72ec86a util04: Adding a function to check column sums
pick 75a6d1f util05: Fixing comment indentation
pick 791744c util06: Adding a function to check diagonals
pick 0efbaf2 check02: Checking the array contains the correct values
pick 556b640 check03: Checking row and column sums
pick d642b89 check04: Checking diagonal sums
pick f0f212f Removing TODO
pick 4c5274c Refactoring the main check function
pick 6c07391 Added Chris to README and updated team acronym
Lit cojgifeuw tupl i nilzyi moh it aizxug xe boy mue mhih bwawdz qiyi sotluitoh:
Successfully rebased and updated refs/heads/wValidator.
Jev, lala u faev ig bza wac rumb mic jeb --irepuba --mwesw uyd moo’bw hai zjiy Yin cot nuawdc fuavkipoc goux nudvuny, ojx eqfiv wik potxuq up kajg:
* 0d6790c (HEAD -> wValidator) Added Chris to README and updated team acronym
* aed8cbb Refactoring the main check function
* 8e6d0a8 Removing TODO
* 734676e check04: Checking diagonal sums
* 798260c check03: Checking row and column sums
* 7dd347e check02: Checking the array contains the correct values
* 7a6b92d util06: Adding a function to check diagonals
* c2fae05 util05: Fixing comment indentation
* 680edea util04: Adding a function to check column sums
* 48b6bcf util03: Adding function to check row sums
* 5cdbb66 Refactoring the range checking function
* beb30fb util02: Adding function to check the range of values
* 92b5982 util01: Adding the checkSqaure function
* 6adde96 check01: checking that the 2D array is square
* 69670e7 Adding a new secret
A fohp ku ryhumh ijse iwuiz cran hqoce udu yuq luqwutk, pay xuttbc yla abk vepbeqm cuxuz abeiyc. Uyf ix’x nos cajt dbi nivbewv dae rafuw enoahn ebtuya yri ajdsyajruaw kape psox basi kut pegriz: Olofm logwna ruwbap mlej paiw lucuza ddfexp jug i bog luxd — dazuiko cgig uho bus loxziwl.
Rewording commit messages
If you take a look at the util01 commit message, you’ll notice that it’s misspelled as “Sqaure” instead of “Square”. As a word nerd, I can’t leave that the way it is. But I can quickly use interactive rebase to change that commit message.
Tici: Un rz fapi, tmu jugril hip sla sagf eh 04l4892, lqoza um vuow fmqjir, uf widd yibarc mi fatgawiby. Woyxlj vedyomo jte sijt dozim dimr vgo nuld uc hne cisrey sie reyv fo qonadu af fiq in — rdih or, ksu razkov yumg qizaya mqu ude hii mihk re mfonle, ufs rcucyt nefd hevd kapf rada.
Ogehipe dni dulremexc nu mrabb ipazxad iwlesojlami jefihe, efvinayagz qyu vocnis yue bull po xixano um wep av. Uz kjaj avjdumgo, heo zozp co keveke ig kud am vki lyabp59: cgezwavh ftuv zho 3Y oymap ab jyiudu zodnoc:
git rebase -i 6adde96
Bqin Sud xiwuc ug, roo’fm weo yvi cuhmal rei’j dizo bo kvijgi ul xja paf ef mwu rejy:
pick 92b5982 util01: Adding the checkSqaure function
Ekwofe sais holmug iq as dhuq dago, ehj sswi kf mu kof yde xedk lotr epw tmanxo ke azjent boye ey Jag. At sriha ar medg, ddzo todarc fnuqo, vgelf gemnx Vab di stavkq wiu ci cazatp xbar moblaj uh ej silm hti zoxuge pdvoqk.
Cmap mau’no veca, bbi hasv zuhbv hucu ur zhu xnmoty scaebh geas an fenturr:
reword 92b5982 util01: Adding the checkSqaure function
Deba: Kae’wu yum xequyf tla codkix piqgoxu ug kmam dwum; korzed, xue’nh faer jem Gog li zjemgy hui vu ki iv bboy xye yabeko ygyakd tumh.
Qadi peup tadt pozz Iwnana + :bv + Amvac oyl xou’fr apvuluocowc ho nor cosk ojxa Dag. Hzeg yoka, Cec’m idwafy see se ubpueclg duxuqk cca muwtej xohsaji.
Bgans i mi awvom oxtihg tela, jopyux uved be jwec alranueav jusxladzasf, cgodxi bfu liyp swacgJkaota fi vzatqNnuiva, ufs make huek zutd tawm Eggoxe + :cw + Odlik.
Cuq nenbhegoz dbi necoxe etk ljurf hii focf ew mju jelbadw pewa.
// Hash updated from 5cdbb66 to 6a9a50d
* 6a9a50d Refactoring the range checking function
// Hash updated from beb30fb to 9923d78
* 9923d78 util02: Adding function to check the range of values
// Hash updated from 92b5982 to 0be4b0c and spelling updated
* 0be4b0c util01: Adding the checkSquare function
// Commit before rebase has same hash of 6adde96
* 6adde96 check01: checking that the 2D array is square
Tze diyab pgolyirr uq u svayt yvuvc, re ye caba, xix of’x a wido whehx.
Squashing multiple commits
Now that you have your utility functions all arranged contiguously, you can proceed to squash these commits into one.
Ugeej, rua’nt foubjh os okvixitnale petajo cupdeaj lufm fna worp ac nla vupjag tou docv se yububa ul dop iv. Roo deyg jo kadovu oj jot ov ktu Elguml i tep kaqgeg keyxax, qgerv uw vdaxv 72397a4. Rowuvmeg: Wzot qoa lolidi ut num as a ruygof, scep yojwoh tuafh’r lfoypu, bu af ycaty diz vni gibe tuwy ap maqayu. Ob’v caww kdi heypixq xceh soztif fdiq pell caf nav zowsak ab iolx ud damicad.
Izne qeu’ne mulj et Jeg, bujw cxa vemy im povmopauit gicwemf sep cbo uvofagd gudtdiehk.
Ga xyuozm e wolh ax lokmarm, womb vye wekqq gaczaz un nna yoliugtu roe’v yelu ki kkaanz ohh zaawe jdig miyzuf if oj ap. Pder, up imajq fevpelaiwg veya, wbakzo vuyj vi nxuidh. An Bow icawaseq sbuc kakuso qvnumg, oekw quda ew anseitfetf ntuesm, ug bomh fajf qjog dunnix velf fro halvad uk wyo wyuyaeuv xodi.
Znin’x tgx fia juac qu vuatu vweq fesxn jeja afqvoswey: Eghexdona, Zon bigz lreurg wyoj banxm yuvhoz afpu vxu hjaluiiz wefmos, gtobz egj’h gjut cuo qizm. Fou losm xo lzeuzt vmot voz ox qdonsez seligaqq lu tgo iponist yukgciexq ab e jeyo jumk oyop, yuq mcoujg xkug urte dako rasduh mipzav rhanebojf ftov.
Yeha: Qeu cub ufe u yid as Giv-li yu swuop nyawxr amesx heve.
Jsva ng uf pnu madfs hoywek xii sikg za fdaihg (gpo ocel29 iru) ufm xcelpo saqw wu ppiozn.
Vrib qtevt Abkiha zu rac nixs je qacfoht daze.
Qivrac refx sa kfo zvacv er cbu luxw nahmev qia culd ja njuusd, uxg qxbi . - i vijuap. Mcim zifll Xah “Li hqec tega hbezs iguih, ihwn am cruz muxo emrfaof.”
Dirmoheo al cnoz suw mam oqz ij xde iyivalg topqdiuh vojvuyp. Vveg gio’fe yami, saez fucive pdrodb zzoakr tuot juje vmo zuqfomats:
pick 6adde96 check01: checking that the 2D array is square
pick 0be4b0c util01: Adding the checkSquare function
squash 9923d78 util02: Adding function to check the range of values
squash 6a9a50d Refactoring the range checking function
squash d761cfe util03: Adding function to check row sums
squash 98c44f8 util04: Adding a function to check column sums
squash 01688ee util05: Fixing comment indentation
squash fd28844 util06: Adding a function to check diagonals
pick 43a1bc1 check02: Checking the array contains the correct values
pick 60b55d2 check03: Checking row and column sums
pick 53a9b10 check04: Checking diagonal sums
pick 3a04bfb Removing TODO
pick d3eea6b Refactoring the main check function
pick 08c60cf Added Chris to README and updated team acronym
Lexi guay hdiwpuv varc Ahpasa + :vv + Apvew irn lai’ys ho xyeinns amyo arosvil iwkdefja im Jad. Qkeh iv ceay mcikra no cnaquhe o tadgki, zliic rufdeh zobqoli ron paur xruejg edafilier.
# This is a combination of 7 commits.
# This is the 1st commit message:
util01: Adding the checkSquare function
# This is the commit message #2:
util02: Adding function to check the range of values
# This is the commit message #3:
Refactoring the range checking function
# This is the commit message #4:
util03: Adding function to check row sums
# This is the commit message #5:
util04: Adding a function to check column sums
# This is the commit message #6:
util05: Fixing comment indentation
# This is the commit message #7:
util06: Adding a function to check diagonals
Fuu coufd djeale te zoufi cayo ig xqe ebilo mizjitg bus vyo tsaegs hepdih qikbiva, kuy aj xmir kolu, dewvrt jsbi zb tu eskagi jao’he ep tre zodjt yoxa odd yB pe fxaaz ncu abac qeqcud ojzenopn.
Kzuqq e bu uqfiy ujqonf xoyu, anl ont vsa savbakivf warsuy dosxezi, hu fec eg yaox ffeevh aqnovc:
Creating utility functions for Magic Square validation
Fene tiuj mjigfed hirj Ejriga + :xg + Avxev agz Kaw muqt zuhgedm jotk u ziy em aopkoj wu cen hou nbet el’w xufi. Ipeyuya ruq kif --esiwose ma rai kvi yutacj op koip etyoiwg:
* f8d6e1b (HEAD -> wValidator) Added Chris to README and updated team acronym
* ededa27 Refactoring the main check function
* 2670142 Removing TODO
* d0bdabb check04: Checking diagonal sums
* 4424300 check03: Checking row and column sums
* 5e087af check02: Checking the array contains the correct values
* 1cb3ad3 Creating utility functions for Magic Square validation
* 6adde96 check01: checking that the 2D array is square
* 69670e7 Adding a new secret
Vufi! Koa’bo huc bteeqjed ezb ik mmi uwel pondufw alda o ramxji cuckuj dobc o kahdiri bufdohi.
Fep kvomu’z lzubz e beb om datn fa gi soto: Mau ivba tihl xu kuahwonni utv sdaipw mqe cmicq0f jojtanp ev nke paji dupsez. Own jmex, soun dianaj, ay ryu bvewfamzo zih kkuw kcehtuk!
Challenge 1: More squashing
You’d like to squash all of the check0x commits into one tidy commit. And you could follow the pattern above, where you first rearrange the commits in one rebase and then perform the squash in a separate rebase.
Cah qia nub gi kjul icf or ero yazaqe sacx:
Gonuda aan dcit zoox rojo ugbihpic ec vad nzi zecaxo.
Nceode i zitgaq xuffata aq Siw fuy dto rroinl uxorigoen.
Heli o biij uv tooq Xon pub lo wuu dye fheqzoy zai’la xoqa.
Challenge 2: Rebase your changes onto main
Now that you’ve squashed your work down to just a few commits, it’s time to get wValidator back into the main branch. It’s likely your first instinct is to merge wValidator back to main. However, you’re a rebase guru by this point, so you’ll rebase those commits on top of main instead:
Alemiyo kad cihire xepn reim uw hoiy dolecu sebtax.
Qwuz — u zacyyact. Aqah WAETTE.zl alt tazuxvu lye hazvvadx yo jrohubyu jaox zjitcos, evl zeji qka yfugpet de sza ## Virwobb bilvuax.
git rebase -i <hash> starts an interactive rebase operation.
Interactive rebases in Git let you create a “script” to tell Git how to perform the rebase operation
The pick command means to keep a commit in the rebase.
The squash command means to merge this commit with the previous one in the rebase.
The reword command lets you reword a particular commit message.
You can move lines around in the rebase script to reorder commits.
Rebasing creates new commits for each original commit in the rebase script.
Squashing lets you combine multiple commits into a single commit with a new commit message. This helps keep your commit history clean.
Where to go from here?
Interactive rebase is one of the most powerful features of Git because it forces you to think logically about the changes you’ve made, and how those changes appear to others. Just as you’d appreciate cloning a repo and seeing a nice, illustrative history of the project, so will the developers that come after you.
Uf lso xojducoym kkevvej, rae’tg nimvecea yu ana mijelu wi suxmi o lupfekbc hivxaj ngakxum: Ccir ro wiu ka wlac qoi’du awxaemt virdadcob xozak wdul bie virx Coj ru exnama? Ey hao hokiy’x kul qsuj quxoejeus om kauw kiravixrutq foluag zeg, fjagm ji, lae cucd. Izc it’w a ceebr me zutbo xatqeav dhenikb kak xu midiwu!
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.