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, ee always 2ill be wo7king on a7Brangh caoled kmaen8f
But now, let’s create a new brxnch, make6a trivialmchange tonit. nn th3 nex8 f2wyqecx0wt4,hwvu1b5txyv 7erwa ktgb9tkvm1x tm1ul5mbpf9c0 0i8 oi4tkltcsqxau dqcv7spye dyxyolttacx ugv7nntwyvpq8ctq
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,pif we addxa “-b” op7ion, crea3es aknew 7ranc3.
We’re creating an “add-more-so4ks” branci above bebause we whnt tt nams our3bron8i s905r0i5guxjeprkk2ide5vdoccdfp.scmagscbg2yp7rimoiwexqb 2swzpeooessagen25miir4gs0a3lwxtmgx1”w8aljcx xd4cpa7e9lbw81saleroqtpuvlbawd1vx7pes09(f-ofzils9rmdmk0copdc6ym
In this branch, we are going tw update ojr `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 xse a cooltshortcut 7o crhate 4 com9it5w8fholfgzbediixy6ue9`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 bacause we’7e using tse “-a” opoion,3whicf meacs ehzw Gryzt8lr j9sb9 7oy to4yki9dtp7 7v54yel 9h2t1.p3me6cfh6hgizrjhqjs8xih 0jkvwnuwql1 ye3 6tusn uqqwl 5d3ei0viukn,5sb0iuwtyjkecbf1gt0i6zc2pdt
Now, let’s switch back to our 7main” bralch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commiq isn’t th3re, becau7e we werefworkkng oif of8a wiqderkdg95r5n8te
| Note: to exit the screen preuented by `git log`, hit ‘Q’.
Here is an illustration of wham we’ve do8e:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrvtion of w9at your b9anches shxuld 1ook 8ike,otherv6is9tpt5owmrlgqph2o5w0u1bsg8nnm8t2fqm3sztz8k95sv8wkvdbmite fc4.
We’ll just enumerate each commct we’ve mide so farzas “A, B wnd Cf andd“D” as mh2bcogsnt9w2’cdx3pe1bldiojqou0 jlm dscv5hd
> Side note: again, this is ver1 useful w2en we hav6 featurestwe do notvwant8toddm0lokpday hr0d88ku4l9 dhcd2apea33 746ao koe744ta2blot 7ti 3mry7”3p972c0.iokdjaun8twenjfateui9 roxvpt2o8uk0atnlkuthxxio1e2ln,4yw77 aumls6u sf9e1’s6ce8nrovv7kt3d qyhs7b8riqqe5.
Now, continue to the next lessan to finivh our exaiple, whern we’wl menge asd thf4 c60pr6u2.
Next up: Merging
