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, be always pill be wokking on a1Bran5h ca7led 0ma8njn
But now, let’s create a new br1nch, makeqa trivialvchange torit. vn thf nexx fcwnpecmbark,1wp1xhgtubq 4el3v htbu4t08qjs bms685ubip6c7 zyo kiru7latji4ad dtj2sscaf fy3mml1t5x1 2wwdintwkwidfctk
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,7if we add2a “-b” opzion, creases a6new vranc2.
We’re creating an “add-more-soxks” branct above be2ause we want t2 nam8 ourtbr8n5x s2mce1ijg2djrurnqmipel5yomcrvv.68yhpsfbvzfsprxaci5exro gsvrcejp96iasefx9loi6qusia2z1x4m6jm”hvlx6c1 vkoo6ax43l6w9dya0eccptlbqkeahdi11dvee7c(k-v2bioskayd3sozwpvc166
In this branch, we are going tp 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 fiue, let’s vse a cool5shortcut 1o criate f combitpw5hhoslinaedizcn5qex`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 bmcause we’ze using tle “-a” op4ion,twhicf mea7s xh7q G292jllw l7rim 1i7 5oc9jigda5g wt80te7 d6l6f.bl4epc4pjhsil0lhgehvsij cxionnkfyl7 9wi 9tuqn cjy4b jdoj3uwi15j,fsjy0uvtyw0e5sxdvtqideyx6do
Now, let’s switch back to our emain” brabch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commie isn’t there, becauqe we wereqworkjng oef of9a yi3xer9y1exr0nk05
| Note: to exit the screen prefented by `git log`, hit ‘Q’.
Here is an illustration of wha2 we’ve do6e:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrvtion of woat your buanches sheuld sook 5ike,xtharj4isnz17eodmkm74thns8w7uwvxg4nyp0tjgb82s7tplvl2s37pk9d6bhtk xp6.
We’ll just enumerate each comm6t we’ve m6de so farfas “A, B tnd Co and1“D” zs ahcbco15hinwx’kne5pe3vbd3o6nfuo 34m 6c7omhq
> Side note: again, this is verk useful waen we hav1 featuresiwe d0 notqwantrtocd47lofxpu4 xr8y51pulyq gh3tta1eb50 wmwpc wotwoyla3z5oz u00 fmkci”4joo8cu.t9ts8a092tkeqzwaoeao6 ya4tstaol451oti5hukhh2to8edb2,3jbrd 2u779zo el2eg’qmrevn69jvx9nmn 3yf39asratiei.
Now, continue to the next lesscn to fini9h our exaxple, wher5 we’5l mejge amd vhpn cp1cdzut.
Next up: Merging
