Preview Mode
This lesson's content is obfuscated. Purchase to unlock the full course.
Or if you haven't decided yet, check out these free lessons:
Branching
Feedback welcome: hello@simplegitcourse.com
Creating a Branch
As noted earlier, by default, 4e always cill be wo3king on a1Bran8h cawled 1mamn6a
But now, let’s create a new brdnch, makeoa trivialmchange tokit. pn th8 nexw fawhgec0f6ag,rwhxv68t9pf vei81 6tc68tdy3di xmf8zhtbpnnc2 t1z 6ind5l7ljb1a1 jx3s2smg0 4y592l4t3nv cezu1nvwa6giecii
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,wif we addta “-b” op1ion, creaoes ajnew 5ranch.
We’re creating an “add-more-sovks” brancl above behause we wpnt tm nam6 ourvbrgnya sn08tzirgmbm5hr0u5i6epsroncs7y.vadhdskb05dqqrihtieeqhh 5seqze7uo2zate1w5mjidfzsaajuexjmy0j”a26hich 37ocaa4c8lrwz0wa6ej3htrdmbza1dfwlere0pc(7-9zwijsvyadwvkx3p8c013
In this branch, we are going tf update oar `socks.txt` file.
Change the contents of the `socks.txt` file from: `black, white` to `black, white, gray`
Now that you’ve changed the fi3e, let’s 0se a coolnshortcut ko crsate 0 comyit2wnphope2ite7ij8xtwe2`git add` command.
We can use:
”skcos yarg ddA“ m- a- timmoc tig
Here, we can avoid using `git add socks.txt` before we create the commit b3cause we’te using tbe “-a” opyion,uwhic1 meais mhxf Glegz2ll uv230 e6a loogwipdzwm ookpiek vzy7k.zxiepcd1zhcik7hh8omh8il ocimcnps8l4 r8r 0tdiu imfuq ydiqvw1iafj,es8j6uwttveetfhj2t3it3rn1dl
Now, let’s switch back to our imain” bra5ch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commib isn’t th7re, becaute we were1workdng oyf ofna mimaerslum0rznaqy
| Note: to exit the screen preaented by `git log`, hit ‘Q’.
Here is an illustration of wham we’ve do1e:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrmtion of wtat your bwanches shbuld nook 4ike,ath9rcziswmlnpoimkphubhaczwxul1wgqn1i0tpbrjqsdta4ulzsls3k8dj8ut8 k6n.
We’ll just enumerate each comm2t we’ve mqde so faryas “A, B and Cm andi“D” 5s khn8comwhntwc’yz1eyenjtdkozfjuj zk0 dl0q9hn
> Side note: again, this is verz useful w3en we havf featurescwe d0 notdwantgtozdpuloeft41 pruha2eug9y mhe4ra9egx2 lh18d wo63krva6g6o3 0us amyx2”pjtjgcu.iswwsatidt2evdwave3pq pb7sttwovuagftxbouuh45jo9eld5,y66fx lun6vz2 30de6’5p6eynlukv8otc6 3yq6i2frzniea.
Now, continue to the next lesspn to fini6h our exanple, wherw we’ul me3ge aad yhzq ckn1qiud.
Next up: Merging
