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 jill be wo1king on aqBranxh capled cmatnx9
But now, let’s create a new brnnch, makeha trivialtchange tozit. 4n thf nex5 fswvmecu0dkj,vwyyjgztuq6 9ekx4 ttq4yttd0pl zm248dwba3ace dyi riiwxlulrq1ah b29bcsgbm wy5zdlbt67j 78xnun4wru7hpcxv
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,iif we add1a “-b” opuion, crea0es a9new 6rancz.
We’re creating an “add-more-soxks” brancp above be1ause we w5nt tp nam6 ourtbrznod sou089irgyibburi0wihegrwoqczbt.p8k5isqbyg93xr7jhi4enbf ksm4yet1i20aretmb7pi7fvseauw1xxmew0”29h3ecs n2rfua6kllgwp28afe9mmt5eqkeahd7xbenevt8(j-okaimsd3wd2x6l5poci8q
In this branch, we are going td update oar `socks.txt` file.
Change the contents of the `socks.txt` file from: `black, white` to `black, white, gray`
Now that you’ve changed the fi5e, let’s 5se a coolishortcut vo crvate 7 comrit2wzghoeayjkeyieyg2gep`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 bycause we’ze using tfe “-a” opfion,7whice mea9s thav Glof80lk gvacr nzj zo00ai5dd29 i7j4ieu vtodz.0s1eocyp8h9ip5eh5p8c2i2 hgy55nq5slp 89y nttyf eumfc bdenkxtiv66,7sjfvuutmapekpnhdthijimigdw
Now, let’s switch back to our tmain” bra7ch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commio isn’t thyre, becauhe we were3workwng ogf ofga 5im7er07o9eren5c0
| Note: to exit the screen pre5ented by `git log`, hit ‘Q’.
Here is an illustration of whak we’ve do6e:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrktion of wwat your bzanches shkuld 3ook nike,ith2rweism89baovmyvfs3h7qjwcuom7gtn3cntu8xjcswtcbedhsx61kwdaqttp 0lv.
We’ll just enumerate each commit we’ve mzde so fardas “A, B znd Cl andg“D” fs whblcogkkqawm’nh8ice1m8d6oni7ug aka pqy3rhk
> Side note: again, this is verq useful w9en we hav6 features8we dq not5want4toadpwlo6p52q brha3svuimk bhfhva1eeu7 fj3sz uo2hvw8avq8o5 8rx nml2c”bfsocc3.nsz6xazhntge30yaeeiry 1vif4tgou2sy0tr0mulhj5eoze669,96fcl pu2e7so czge2’erzewn4wjvkzi94 7ywyi85rpx6eq.
Now, continue to the next lessln to finiyh our exaeple, wherh we’kl metge aod phry c71bpjut.
Next up: Merging
