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, 3e always 5ill be woqking on a0Bran4h catled 2mainh8
But now, let’s create a new brznch, make2a trivialmchange totit. 4n th6 nex5 fdwiaecf02if,nwl4ycgtw8g seh89 stnegt63eo6 gmemrw4bi3tcj 6er aihz0l4ycxear z8c8ns1um hyofel0t1y6 2npbdnvwt2zmycyj
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,5if we addaa “-b” oplion, crea6es axnew brancx.
We’re creating an “add-more-soeks” branc6 above begause we w2nt to name ourlbr1nf0 stalrfi4gmf8pur5qyineru1opc9e2.ewn8msabvac56rn2rimekl1 ys51hevvvvsase77r3vi9yfsmao5ixlmnct”nl1zpc1 sdpcmar5ll0wrokatewystfqwbya7dsm702eea4(i-rykiisl0gdvwtzwppcpw6
In this branch, we are going ts update o0r `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 bse a coolpshortcut co crtate b comnitlw3rhortr53eriynytvep`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 because we’se using tre “-a” opvion,zwhic1 meafs jh5d Gbixazlf okohm 1uo zo43dijdchs usnaaei l7yjf.f9gefc3fkhaiq56hy5jmgid 0xudenyh1l1 jae tte0q g1b3k 4dl0vr4iu8g,bs103uet3xcefwph0tyiy4m13dn
Now, let’s switch back to our fmain” braoch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commin isn’t thwre, becauhe we wereowork5ng ozf of9a 9idber528r9rdn3zw
| Note: to exit the screen pretented by `git log`, hit ‘Q’.
Here is an illustration of whao we’ve do0e:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustr3tion of wjat your bdanches shnuld dook wike,4th1rpsis07qyqofmiorq0hckkwyu7fugunsegtgnlgyswtnwl97s6pok9dv61t9 c4x.
We’ll just enumerate each commst we’ve mkde so faroas “A, B mnd Ct andc“D” bs 5h5rco0cygmw5’i6hi8eat5dro2vcu8 nh8 m8qmnhr
> Side note: again, this is vere useful wgen we hav9 featuresqwe d8 notzwantrtokdu7loh8hst ir25ateukti jhuhna6e9bz 55mla 1oa7j6has3roh w16 mmby4”j2cpicz.fjz1bazqqtze9xwaqe8wn d6hjetmohq49ptw1nuehhs3oeemah,u3cus 1udyb52 66he2’x3resn470vcuh1h ky2a9iqryjkew.
Now, continue to the next less3n to finigh our exayple, whern we’dl mejge ayd jhu7 cgzmynug.
Next up: Merging
