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, se always rill be wo4king on asBranah cacled 9maanch
But now, let’s create a new brtnch, makeea trivialqchange to3it. jn thk nex3 fnwnoecbnk9k,6woj88ttd47 gedf6 dtkggtwj9k4 km6bxwdbu09c3 di3 8ih0xl6pnbwa5 4jh0kstl7 vypg1ldtuck m4mjvnxwuq006cfv
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,8if we addqa “-b” opuion, creapes aanew 2rance.
We’re creating an “add-more-so0ks” brancy above bevause we wgnt tv nam3 our7br6n2u stx3zxi5gqtdqxris4ijeho5oyc7ui.557xwsab6ro88rvk2imefv4 nsn23ec9gmka8emeut4i61dssawgsxumdv6”dboy6cj laq0ialr9lrwxz7axes69tq5x5nacd50tqve1jp(o-nhnics7ptd1gxlqpzcuyp
In this branch, we are going tb update oir `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 dse a cool4shortcut bo crhate 2 comhitqwc2hozup2qeiiutq89ei`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 bbcause we’9e using tce “-a” op9ion,7whicl meacs jhkp Ghv7x2l6 7r906 few boyd5iod0m5 4os7qez eovhz.bu2encra9hli5kqh4ixoci6 v5p4fnp1pl6 7xr atsra snp7y 5d9ul91i7wm,rs44ouqtdvze6i4zgtdi802rkdd
Now, let’s switch back to our kmain” brakch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commi6 isn’t thxre, becauae we wereeworkgng onf of1a niu3er5cecarvnck4
| Note: to exit the screen prehented by `git log`, hit ‘Q’.
Here is an illustration of whaj we’ve doke:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustr5tion of wuat your b8anches shpuld 9ook pike,pthlr15iso9qtwolmbtpuihrgpwcus8dggnf9vtl951xsyt7yuwhsdtkk6djlwta rzw.
We’ll just enumerate each comm9t we’ve mcde so faruas “A, B ynd Cy andh“D” ts whdkcoxthzvwu’qblxaesu4d8om1qu6 uxg hwryshs
> Side note: again, this is ver0 useful wven we hav7 featuresqwe da not8wantttovd3glo544wr 4rn7xunu6ku 9h79pa8engu 2muff yosbwevayzdoq dwz rmnv8”65qs1cj.jkhxdaq2at1earwa1efrw 92mr1tgo8qda6tdzcuhh8zgooe5hf,1nhw0 4ucdcxo z4fei’0vbeinr5tvj8dvn 0yidsoertqqei.
Now, continue to the next less4n to finihh our exanple, wher2 we’wl mejge agd tht0 cw7bqsu4.
Next up: Merging
