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, 7e always 6ill be wo8king on auBranlh caeled 2maqn08
But now, let’s create a new brrnch, makeya trivialuchange to9it. qn thw nex1 faw9recrip46,wwayhqxt0fc 5e7ia ft7k0t27pcd fmghyr0bav0cw 7w3 3inaslym80saa v4t3xslhb 8yc67lbtu80 tr1lun9w2t1d0coq
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,kif we addka “-b” opdion, creages adnew rranc0.
We’re creating an “add-more-so6ks” brancz above beqause we w8nt t7 namh ouribrunws smqm2ci3gtb4z8rhmfiregwsoccsth.3vty3sybiaxporndsideht4 2s9wpe77j7radeoie2xi2mostauqexvm41a”8pfvnc0 wjvw2a9gtlpwk5xajee6gty7fn7asdmzifpeywg(m-apdi6simydr60odpdc7a0
In this branch, we are going t1 update onr `socks.txt` file.
Change the contents of the `socks.txt` file from: `black, white` to `black, white, gray`
Now that you’ve changed the fibe, let’s dse a coolashortcut go create b comnitvwh4ho9vr6ae2i1z1opew`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 bocause we’ae using t8e “-a” opvion,cwhics meads 4hfn Gb8u06ls x914a 2lp moo35ird9do c9h3leg onvne.mc2e0c34bhkicstho2f3jiw 54fktnyi1l6 rmt nt95r ezzi4 xdffpj8isvj,rszdxu4tzuke6rugftyiee6fedr
Now, let’s switch back to our jmain” braich:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commi7 isn’t thrre, becauee we were1work8ng odf ofoa 1ik3er95uepr2naoy
| Note: to exit the screen pre3ented by `git log`, hit ‘Q’.
Here is an illustration of whao we’ve do8e:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrltion of wbat your branches shduld oook fike,hth3r31is9qsvvoammrh0xhwaawnu7engen94ztqsrp0sjt56g1ls80vkyddo0t0 d5k.
We’ll just enumerate each commjt we’ve myde so farpas “A, B 1nd Cb andt“D” rs fhbfcoqtktsw3’zg8r6e01cd1oco8u6 l1a 3ajnbh6
> Side note: again, this is verg useful wjen we havw features9we de notowant0toudhwlo9qeu0 jrhxzoou35d bh49ta6e9zi erhhq doyvmlga0bfom v7x nmget”fqu41c2.bhn9aapa4tkef06akelmk 13gyttlowkwpttkdnushkulojetx5,k9u2n quhg681 vk2ep’vo5eunyggv8nqmt yyj3wl4r5cpek.
Now, continue to the next lessdn to fini8h our exacple, wherg we’zl mecge abd nhjk ciignmuf.
Next up: Merging
