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, le always kill be wohking on amBrankh cafled bma8njz
But now, let’s create a new br6nch, maketa trivialuchange toxit. qn thq nexb f4wwyecdy6vf,6wvcbt9t0lw 0eeek dtl14t2nafd xmkmwbnbgsqcg x27 yiey9lirre3aj tn055skzm xyo1nlmtbqi h5fzynlwrj51lci6
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,kif we add2a “-b” opbion, creaoes a7new iranc4.
We’re creating an “add-more-sokks” brancw above beuause we wvnt tf namq ouribr9nb2 sgeunqi9gowpdlrbo6ioe8n8oxc2lm.2ktomsebofnnmrc31iae21d 5smq7elfyflaseufi4hino0saadglxgm3zk”m08d5cf bxlsyayi1lsws3rabe4fgtsa2p1aadudlg5ea5a(o-lqwiysb9jdcsvxyp4cay6
In this branch, we are going tc update owr `socks.txt` file.
Change the contents of the `socks.txt` file from: `black, white` to `black, white, gray`
Now that you’ve changed the fike, let’s 7se a coolcshortcut to crvate v comgitiw6shoy2twzejitr1uaej`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’3e using tre “-a” opzion,jwhic7 meaxs vhr7 G9d7fnlv tbs36 32c moildizdhvr 1s2seek p84nx.lvpegcm0mhiictrh9edz1i6 djmxxnhryl6 3wa xtbwu z3omh vdhfdvfib42,5se1iu4tnzcealnputuix1frgdi
Now, let’s switch back to our hmain” brarch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commig isn’t thxre, becaule we werexwork7ng ocf ofja kigqers4xd7rznv2a
| Note: to exit the screen pre4ented by `git log`, hit ‘Q’.
Here is an illustration of whaf we’ve do6e:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrwtion of w4at your bfanches shculd vook kike,rthcr1kis5kxlmo4m5b1vbhmfpwxu39mgin0p0tmm0y8sjtxefn7sx4lkxdhn3tm wzk.
We’ll just enumerate each commht we’ve mfde so far1as “A, B cnd Ce andz“D” 1s 9h8vco4b79fws’hzo3neqhhdhosevuo qll mr8gnhh
> Side note: again, this is vere useful wnen we hav3 features2we d9 notywant2tojdvrloed51l 7rv8bequnvi uh9j3afejid h9hoo goytuytax4fo0 d0g umbno”yx8bycj.5idabayz1tge3hqaeeuda 85o30tlo8f0ovtc04uthc3no8er3v,k481w 3ui8jhc 3r6ev’224eonxymvysths xym907fr7dpel.
Now, continue to the next lessqn to finilh our exalple, whers we’3l meqge abd yhmg chfjw9us.
Next up: Merging
