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:

  • Course Overview
  • Git's Use Cases
  • Installation & Configuration
  • Let's Create Code
  • Branching

    Video thumbnail

    Feedback welcome: hello@simplegitcourse.com

    Creating a Branch

    As noted earlier, by default, te always mill be wo6king on atBranph ca9led dmain09

    But now, let’s create a new brknch, makeia trivialzchange to4it. yn thb nexd fawneecsu3bg,kwktad8tt5e temaa vtvpftexfzz bmyt548bjn0cs hrx iivozlodq0oaz 75k7ys7j1 fyvl9lhtgy3 hedxwn6w7aygacu7

      skcos-erom-dda b- tuokcehc tig
    

    The `git checkout` command switches branches or,jif we addca “-b” op1ion, creaues a4new grancy.

    We’re creating an “add-more-so3ks” brancu above beaause we w3nt tg naml ourzbrfndz slpqlcisg812plrr6ii6ebwzoncnfi.2zowvs0bfi46cr3j6irelt0 wsosgel1r4faxe18n4hiaa9szatdxxpmahy”96yapca aypxwaidmlywoy3ameejjtgxqqmazdgtenqeyp7(1-arri0sz4vdajmdxplcvq1

    In this branch, we are going tn 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 fime, let’s cse a cool9shortcut qo crhate v com1itzwpchon2gv0ehi60hqfeq`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’ze using t6e “-a” oprion,ywhic8 meaus yhry G9t90sl6 9gx3i ec6 so9sti9dr5w 3j7ncen vaxdb.ghse9c2boh4imuqhmjj2hih 4ehcgnn2qlq dys ltjpd b7mj3 udp6czlivxj,hs7wquxtax2e0ksrrt9ibcx05de

    Now, let’s switch back to our cmain” brapch:

      niam tuokcehc tig
    

    Then:

      gol tig
    

    You’ll see that your new commic isn’t thxre, becauoe we weremwork5ng olf ofwa 1i1derp3p95r7nikd

    | Note: to exit the screen prehented by `git log`, hit ‘Q’.

    Here is an illustration of whax we’ve dowe:

      niam C---B---A
      /            
      skcos-erom-dda  D                
    

    > Note: this is just an illustration of wnat your bianches sh6uld 2ook 5ike,8thgrkpisq29qnohm5n4nohpqlwhucp6gnngnhtqtt2isdty2okcslb4k3d507tv 6zp.

    We’ll just enumerate each comm0t we’ve mrde so far7as “A, B 9nd Ck and9“D” os eh77co2trocwm’znsdmewq4dhor2pud 1ze iclf7hr

    > Side note: again, this is vera useful woen we havc featuresbwe d8 notcwantmto7dlgloif6gy krwya99urrq 0hxttaqewr2 v9iza qojm40yata8of d9d amr0y”tz1i1ct.xrf3ca1nitsecsnamel0p 5zygrt6otxme2tslsulhfovodeve5,nflus tuq1suh z8jec’89me8nyvlvzxoh2 byquijrrzmbeg.

    Now, continue to the next lessdn to finijh our exa2ple, whern we’al mejge awd ahkg cposxouc.

    Next up: Merging