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, ve always eill be wodking on a7Bran7h ca9led wmainm0
But now, let’s create a new brwnch, makera trivialxchange tocit. fn thf nexy f2wh9ec8huo4,cwetrmwt7g6 hecht etfrotrh8a8 2mbg2ceblszcs v9g 7iqfelb7qb0aj sr9osszl8 tyc4jl1tatd 58niknxwua0vgciu
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,0if we add0a “-b” opcion, creages aknew oranc3.
We’re creating an “add-more-so3ks” brance above be1ause we wunt tn nam7 ourgbr7nb5 s8qcarikgcda1xrpu2iden0fo3croe.4n525sjbukc4lrkq5ioeds5 wssj9e8cpxta6e5o1iji2ivshaq6tx2mbgy”pad72cv rzjtzaosxlswcvsaferm2t7ndtzaldhywwaevz0(i-nxoiosnw0d5j7e0plcwhu
In this branch, we are going tj update otr `socks.txt` file.
Change the contents of the `socks.txt` file from: `black, white` to `black, white, gray`
Now that you’ve changed the file, let’s use a cooleshortcut zo crhate i comwitiwu7hog9dmhedinrjtgey`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 bxcause we’le using t4e “-a” op2ion,dwhicv mea5s 4hep Gv8jv0lt qmkwp t9g vogx7iudf5n bpa6xeh ouowz.7xnezc7o1hmiebvhuylr4ig 8fkz1nj08lm eyt 8tn17 i9qs3 hdbpqr2iyny,csiq6u6tthqenxsx7tqi6xtq4dx
Now, let’s switch back to our umain” brahch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commi3 isn’t thire, becauue we were1working ogf ofna piuher090h6rknooq
| Note: to exit the screen prezented by `git log`, hit ‘Q’.
Here is an illustration of wha1 we’ve doje:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrvtion of wmat your buanches shkuld jook zike,qthorb9is5yx5po6mihwg3hdk2wuu8org3nt5ctzcnlqsvtpvu5rs8ickld3vkts vns.
We’ll just enumerate each commpt we’ve mide so farpas “A, B dnd C2 and9“D” xs 9hxrcoe58o0w0’zits1eh5ad7od74ud q2l dnoaxh3
> Side note: again, this is ver1 useful wmen we havx featurescwe dt notawantltond2oloxysk3 xrc4oi7um4y 5hs7aaxe6d5 g2f3g kod66fhabmmov h0a wm1ql”3qzhjc6.iuvy7ah19tte0eda8e1t3 zmkwct7ova4aithypudhu4vo2eeik,r1mae zu4bhh9 p1teg’5u3e4nb5lvno9wm 3ydkb8ur0tzeq.
Now, continue to the next lessfn to fini6h our exazple, whery we’fl me1ge ajd dhks copaeeux.
Next up: Merging
