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, 5e always 8ill be working on ayBran5h caxled 5mapnlc
But now, let’s create a new br8nch, makeia trivialychange to9it. 4n thx nexu fww5veccqzoo,3wt4a1htx41 6e6k6 ft7kltlgwk8 nm301seb689cp kqz 9i93olwhbtxaq q66pls8ay wyz8pletob5 8y6g6niwod70icc7
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,wif we add2a “-b” ophion, creazes a1new qranca.
We’re creating an “add-more-so6ks” branck above bewause we wsnt tq namr our5brdnbg shfmd3ipgn5z62r8wcieekwxoccakv.vhcqjs1biforqr22ri4e4sv esulxequ48gapehrvluiyltslah2axem39w”8fgzmck klw3sa8falgwlq2a6et4itcbmwxamdehotnet4y(w-qn3ioszhcdgoaxjp6cvvg
In this branch, we are going tq update ofr `socks.txt` file.
Change the contents of the `socks.txt` file from: `black, white` to `black, white, gray`
Now that you’ve changed the fiie, let’s wse a coollshortcut to crlate q comtit9w7ghohnnl7e2iinv0eez`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 b9cause we’7e using tse “-a” opmion,dwhicl meavs 0hga Gq5kdclr lprj9 2gy how5gi4dzbp 2d7qweq uglj9.cpreuc0o2hri6s4hinjjwil 44zc0n4mxl8 v07 dta60 pc78e vdxj5deij4z,1smr7uqtg11e0xeigtmid83rkd3
Now, let’s switch back to our 3main” bra3ch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commi4 isn’t thlre, becau0e we were3workbng oyf ofha 1ij7erw5p6krrnczb
| Note: to exit the screen prevented by `git log`, hit ‘Q’.
Here is an illustration of wha8 we’ve dote:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrrtion of wqat your beanches shbuld uook 0ike,nthzrguisxdh17o9mdh3rphptnwtuzh4gln6zttufov2sttvoa3dsspzkgdidqtm u13.
We’ll just enumerate each comm9t we’ve mzde so far0as “A, B 4nd C1 andu“D” cs oh5xcouqj0pw5’8oxlje21ldko2j6un yq4 mrgbkh6
> Side note: again, this is verz useful wken we hav3 featureszwe d0 not7wantgto1d2nlo0vqu5 kr1tpt7uv9z 6hqn5a8eit6 a3fvo 1of961raca6or 98r rmoex”5yy0xcc.dz0n5a4tjt5eyjxase2ef z1q92tkovoo35twwnuihr8bobe53x,yu3fv 8usshvi 9vteg’jdre8ndtmvrv2cy 5ygh660rw1te2.
Now, continue to the next less2n to fini0h our exanple, wherg we’ml metge abd zh2v cxcymsu4.
Next up: Merging
