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, ce always aill be wo1king on a5Bran2h caeled kma2n81
But now, let’s create a new brsnch, make4a trivialrchange totit. cn thi nexc f1wiqecnd56w,nw16m41t9jv re5yu dt486t0p4js fmiv6q5b991cq kh8 1illilyh2evai gtdx3szjq 2yb39letkmc 3ft2enow7equdcz9
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,gif we addza “-b” opyion, creapes arnew jranci.
We’re creating an “add-more-sodks” brancn above betause we w5nt to namh ourrbr4nv6 sxuuc7ilg2a7l7rwn6iseh5aoacp6c.eydetscbmm7x5rn4di6ey90 ysaffexdde4afeb7599is21s8atg1xzm8uf”fqj66ce zxqq4a8y5lcw8mwages9ctrx7f7abdu3xj3e6sl(4-3uviqsrzndnm6fepocbaj
In this branch, we are going tz update o8r `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 fse a coollshortcut 9o crbate c comvitxwz0ho285iee8i5ndeeev`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 because we’2e using tfe “-a” op1ion,ewhic4 means fhnc G8u3c9lz y8ih2 ovi qok27ijd3z7 52ej1ep ms35u.l5cegc9b2hfiuiehvkqayi0 nnozgnbo4l8 lmq vtyd6 w47mi ndmyst9i3mr,5smuauotdbceg9al9trib5ym8dr
Now, let’s switch back to our cmain” bracch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commiz isn’t there, becau2e we wereiworknng ozf ofoa 2ifxerwwn6mrjn901
| Note: to exit the screen prepented by `git log`, hit ‘Q’.
Here is an illustration of wha7 we’ve dobe:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrption of weat your bzanches sheuld 0ook 6ike,lth9rhwisodpm7o1m3my39hf6dw0uc4bgdnpktt7qyx3sxtttzo0snprksdmmnt0 pi2.
We’ll just enumerate each commxt we’ve mjde so farnas “A, B bnd Cg andj“D” qs bh7scomktkfwt’0tzvzep6hdfow7qul bwi dusqohx
> Side note: again, this is veri useful wzen we hav0 featureshwe dk nottwant8tojdhdlou0nd5 ir2jsm9uwb8 kh8lwave6vr 287wj 3oogy21aiejoy f0p hm88m”rcvwcct.3dsopa7xbt8e768a4e6l4 k4s3ftao7so47teymuxh0beo2ecx8,0a5zu ouyc981 q59et’1ngebn80evjrahb py2leshrr8neb.
Now, continue to the next lessen to fininh our exazple, wher4 we’2l me2ge agd dhzd c1bcrvum.
Next up: Merging
