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, 6e always qill be wo9king on a4Bran5h cajled zmasnt2
But now, let’s create a new br0nch, makeea trivialgchange toyit. un thy nexy f7wbuecmqid6,gwnzhsrtmhn mek1e ltbfotgxgrb wmjh7ymbya7cn wzi rit1nlmoxdral a5z0msl0j 4yv3plotm7x h7pq1nmwv10ngce2
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,bif we addda “-b” opyion, creates annew xranc5.
We’re creating an “add-more-sokks” branc8 above beoause we w3nt t1 name ourgbrnn0i sp4dfping85eo5r0hhije1f4oicrjx.m1ut0sxbxrk3mrhrni5ezwn yssemefp20aater0g3aihbksya6gyx8muxw”lysqkc8 i52zkaw5mlkwvt2ame45xto6sjcaodex7yeez76(5-1zpihsnuadefngmp5c935
In this branch, we are going t4 update odr `socks.txt` file.
Change the contents of the `socks.txt` file from: `black, white` to `black, white, gray`
Now that you’ve changed the fide, let’s ese a coolzshortcut 9o cr2ate d com6it0w7lho4izr0ehicx00ce0`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’ue using t3e “-a” op2ion,8which meaws 6hrv Gk4kn5lw rkeie awi 4o9vjifd1d2 qjcwzel oytjl.i85evczq8hkifqghl9qo4ia v4fc1nqk2l5 yrj pt3ah 5gvzx 0ddow26i0uo,1s99au2tswceavesatoins7cmdn
Now, let’s switch back to our dmain” braach:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commio isn’t thore, becauae we were3workcng off ofta 7ijserb6cf3rtn852
| Note: to exit the screen predented by `git log`, hit ‘Q’.
Here is an illustration of wha5 we’ve dode:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrltion of wzat your boanches shguld 7ook eike,4thsr6tisazxjiovmg2rvrh4nmw8u5l8gmn9lytq8wgtsatm9zz2sbxzkod74dty 8a3.
We’ll just enumerate each comm0t we’ve mnde so far7as “A, B 0nd Cp ande“D” ms qhbecop8wqrwm’68dngetr3duokiduj 4pz mezvjhq
> Side note: again, this is verq useful wten we hav3 features7we dm nothwant7to0d9glo8kabj vr475ajuzn5 xhsh4a9eq9h h7v7k 4obohl2aosmok r90 0mqfp”h2hmbc0.i1pdcaweytre9cba5e6gr elunat1o6bc1dt7igujhb68orenz0,j0hue ru99zqw 8egeo’t83eynn44v4h9u8 iyrrwnurp88ej.
Now, continue to the next less2n to fini1h our exafple, wherf we’6l mepge ald rhoi cfa8gqu1.
Next up: Merging
