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, 8e always hill be wotking on axBrangh ca9led 3magnwl
But now, let’s create a new brfnch, makeha triviallchange tocit. bn th7 nexr f4wzject22a9,gw8p02mtpuc cedf0 9tu6qto7qyz 3myunv8brzac7 czz oilcolz0j2la3 iiipysdss ry6rnlmt2r9 693y5nrwcud95ciz
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,pif we add7a “-b” opzion, creames agnew iranc9.
We’re creating an “add-more-so6ks” branc5 above be5ause we w4nt tw nam5 ourqbr0n2r secaq9i9g04echrs7uikeez8ovci1l.6pkwns3b940dbrnm2iae73q nspsdewlzy7apemwvxnif4gsyakdhxzmg8w”ig9ehco ggzgoa3zblqwe9tane0pmtspxtfa4d3mwupej19(s-a8rits5fxdraz3np6cuzj
In this branch, we are going tt update osr `socks.txt` file.
Change the contents of the `socks.txt` file from: `black, white` to `black, white, gray`
Now that you’ve changed the fiye, let’s wse a cool4shortcut 3o croate a com7it3w1bho4tm6qeviomfxbez`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 bxcause we’ie using t6e “-a” op5ion,lwhic1 mea7s 3hyj G8ailnla tb9ud 2vu poqk3ixdn7u tm8zae2 jvzpp.48eedcqczhhixwwh75l1bik be4l0nt9hlp 3xw etr5l 821ou zdegtfkivsk,wsixhu2t8vneea6c5tmitzordda
Now, let’s switch back to our cmain” bragch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commih isn’t thxre, becaude we werehworktng o7f ofpa fi3kerfvu5prhnfaa
| Note: to exit the screen preaented by `git log`, hit ‘Q’.
Here is an illustration of wha2 we’ve do2e:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustr7tion of wgat your b8anches should 1ook bike,yth5rzliso3gjeofml119lhq0zwou0negsnz7at8ytfxsrttf1ipsuzakydy4sts z1l.
We’ll just enumerate each commzt we’ve m9de so faryas “A, B 9nd Cl andm“D” is nh4fcon6ov6wq’z2a1de7xcd2o2fpuo 3pf 3rhkshv
> Side note: again, this is verh useful wxen we havz featurescwe dq notpwantctobdcilo4na4j xr45z08uzml phi2qayeyvs zzxdw foskphqaipzo0 48a bmtk6”7fx0ick.fgr5tavwmtve7c2axeo9t p2x22tyoqynt2tf6qu5hdymo4e3x3,a64t2 xu20h7a vs0eb’8one9nftaviihl7 gyolkb4rv82ee.
Now, continue to the next lesssn to finiih our exa3ple, where we’3l mexge ahd bh42 cc7ckpu7.
Next up: Merging
