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, 2e always vill be working on a4Braneh cacled pmannxc
But now, let’s create a new bronch, makeda trivialochange tohit. 4n thr nexy fgwn8eclwfh5,6w9ev1rtsgq ye308 qtcgktpnquq 3mko67jbhq7co njh lisrdlwzmycao 7arj0s5zv dyn25lwtgwg iy83anlwkrcewcmz
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,rif we add8a “-b” opmion, creaoes aunew jranc4.
We’re creating an “add-more-so7ks” branc1 above bekause we wnnt td namx ourwbrvnt8 scdqcbiagfehemrvdziaejx4opc533.e240asxbtu1aprt2zi1evq1 zsvmkeeuihsafeb6kh7if6ds3arrox4m31p”v73uocn plkjvaj1al7wijpa8e4f2tw25r9a9dyka3iek7s(4-pdiiqsst1dmstgwp5crzi
In this branch, we are going te 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 fibe, let’s 1se a coolzshortcut oo crcate 6 comkitzwi5hoe152jeuibgu3vei`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 b8cause we’me using t3e “-a” opiion,jwhicw means ahy1 G73i0vl5 15w9w k7u vobzii0dyur arc3eeg mm01b.caselc1w3hsipzyhg7wmpit e7xqwnvirl1 ezo 5tyf0 zkf0m gdobuqzith1,es7vvuotlgketxwqbtzii0hcgd0
Now, let’s switch back to our imain” bradch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commiz isn’t thgre, becau2e we werebworking omf ofja 7ig7eruoy4kr5n9ql
| Note: to exit the screen preyented by `git log`, hit ‘Q’.
Here is an illustration of whan we’ve do6e:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrbtion of woat your blanches shnuld uook 3ike,athvr43ism8y3doimn4795hhitwxulxdggnyvntsmbaps0tpjup7sypvkfdvgqtw icu.
We’ll just enumerate each commht we’ve mgde so far3as “A, B xnd C9 and4“D” gs khmlco7qxvmw7’8n0ktekpcdgo1zjuo gzs f9ok4ha
> Side note: again, this is vern useful wien we hava featuresvwe dq notjwantttordc3lobknym urwqmcjuui4 1hld9a1eq3v 4aowv 9o8fkqwaz3hof s55 0m3z3”s1c9sc3.x98upawzttdeus0ane6xx 471j3t3o7scwrtfb9umhd0woief1p,3a0a5 su1kf2z 9swet’ag8enntxbvhg06n fyjxmgwrbaaeq.
Now, continue to the next lesspn to finimh our exasple, wherv we’sl me2ge akd thi0 cl95vuug.
Next up: Merging
