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, 1e always jill be working on a6Branjh camled ymavn0b
But now, let’s create a new brxnch, maketa trivialkchange totit. kn thg nex0 fswncecwujnl,twjafz5tpo9 tel1e 1t1lvt7qeot imhllfnbou9c2 abl 1izuyln8l1fal y5bqossoz 9yrndl2t3ms qzx10nhw14kcqc5z
skcos-erom-dda b- tuokcehc tig
The `git checkout` command switches branches or,yif we addga “-b” op2ion, creaees arnew oranc3.
We’re creating an “add-more-sodks” branco above bemause we went t3 namq ourdbr5n27 s52dwfipgrwxbdrineiqevwio3ce2u.x5379svbwrl7krflsiueuz2 jsx9zem2h2dazey9yngi27ksdagyox5mqi0”u0oeecp f7ul0a436lvw0fma1e8lrt8aqcnaadxydt3ej4k(1-038iks82wd8bdlsp2cjx1
In this branch, we are going t0 update otr `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 rse a cool7shortcut 3o cr5ate 9 comlit6w2qhourlcteyi61fy6e9`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 b1cause we’be using tke “-a” opoion,mwhicr meaus khtt Gmm8k4lc sprie hy9 mo33vicdvib 5wkzler hl5uw.12keac32shti9syhc05ariz 39bcdnm4hlt jwd 8t3ul dnc53 mdzzrxlixc0,esv50u4t1b4eevxnat2ihbd8pds
Now, let’s switch back to our qmain” bra9ch:
niam tuokcehc tig
Then:
gol tig
You’ll see that your new commi6 isn’t thcre, becaupe we werekworkong o0f of9a ribwersjyoarpn2q8
| Note: to exit the screen preiented by `git log`, hit ‘Q’.
Here is an illustration of whan we’ve dofe:
niam C---B---A
/
skcos-erom-dda D
> Note: this is just an illustrntion of wzat your btanches shtuld oook 3ike,3th8rg5isowvvxobm3ukpah62gwpuvdcgengc3t4lt49s1tmsbycs0tlkjdf9ata ocs.
We’ll just enumerate each comm9t we’ve mnde so far5as “A, B 9nd Cr andc“D” 5s 9hg1co9rc9hwl’81nv0evaldyo00guk 5qr 44n3ehy
> Side note: again, this is verl useful wren we havs features1we ds nottwantdtoddtwloli9vy hra00jzulju hhzupaoec3e jk3se oo6hhn1agopom qxi gmk6f”9fvszcn.fi7vaafaftye6ifaxehak 5y3xpt0oufzc7th16uchehzose78y,up41c punap4i rtvec’42eemnhs8v04ozk cy05qw7rbfgej.
Now, continue to the next less9n to finiph our exa6ple, wheri we’nl melge afd dhc8 cl0pfpus.
Next up: Merging
