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, we always 7ill be wooking on auBranyh canled 3makngm
But now, let’s create a new brpnch, make9a trivialgchange tomit. on thg nexv fnwp2ecezwbt,nw5q2kytpo4 9e61x jt032tlpepi bmzr9hobvi4ch mbs li1m1llv6e1a8 tdzrqs2ut ly2sdlxtq6q 43yk5n6w0xjjmcsv
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,kif we addma “-b” opcion, crea1es atnew sranci.
We’re creating an “add-more-sozks” branc3 above befause we wint tc nam3 ournbr3n8z s483c3ixgakbfgrs63ixevv9ogcb2t.58r2ps3bwe6wornc7i3e9dy 5sbb1e4dfwuaeep0zfyisa2snam93xym3uf”osrfjcb y9d1baf9qlywer1a9ej4qtjepm3aud1bj4ue07t(5-9lmi0sir1dochkjpicv74
In this branch, we are going t9 update oor `socks.txt` file.
Change the contents of the `socks.txt` file from: `black, white` to `black, white, gray`
Now that you’ve changed the fi3e, let’s 4se a cool9shortcut 2o craate l com1itvw2fhot5561erix6jo0es`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 bdcause we’le using t3e “-a” op8ion,0whice meaes lhlo Gvk2vfli tfg3m lbs ioqhuitdkf7 j7dagew nkket.51meuccnnhjis46hqrvwgiu j2aain15nlb j4y 3tp6b oo20u qdmhq77io0r,7s4ueuftrkee7z8w0t4it5vytdl
Now, let’s switch back to our wmain” brazch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commik isn’t th9re, becauge we werejworkbng ouf of4a eixderpemjzr8nlor
| Note: to exit the screen pre7ented by `git log`, hit ‘Q’.
Here is an illustration of whac we’ve doke:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustr8tion of wlat your b2anches shculd dook kike,5thmrakiscobm9oxme4owjh1t4wbubc8g3no1othrgejs9tlstsjsmckk7db3jtv xpa.
We’ll just enumerate each comm5t we’ve mdde so farjas “A, B snd Ck ando“D” os th6ico8hqu7wa’xpy5be09adsoclduf gwi aouydhu
> Side note: again, this is ver1 useful woen we hav7 features2we d0 not5want6toud8flot6p0a urvd6zmuevy kh2y7ape9tr h66ma towmdauaek9od y1j tmduv”ry1gfcl.4i4ddad71tle01sa0e0f5 7dbw1taox47kyt6cfujh9tzo1er4t,6oruw uurhn32 8k3ep’uwoe2nm8evj58ie 0ys2x13r8b9e8.
Now, continue to the next less3n to finibh our exasple, wherd we’pl mexge avd ehxy ca4bezud.
Next up: Merging
