#100Devs - Intro to Git And Github (cohort 2)

Class 24 of our Free Web Dev Bootcamp for folx affected by the pandemic. Join live T/Th 6:30pm ET leonnoel.com/twitch and ask questions here: leonnoel.com/discord

Skip to first slide
Slide 1 of 99

 

Intro to Git & Github

Leon Noel

#100Devs

Sponsored by Microsoft Azure!  


Slide 2 of 99

Agenda


Slide 3 of 99

Questions

About last class or life


Slide 4 of 99

Checking In

Like and Retweet the Tweet

!checkin


Slide 5 of 99

Friday With Friends

Tomorrow (Apr. 1st) 6pm ET on Discord!


Slide 6 of 99

Who is this for?

*Never used the terminal, and thought I was saying get


Slide 7 of 99

Community Rules

Github Code of Conduct
https://github.com/microsoft/virtual-events

 

!githubcoc


Slide 8 of 99

Career? 

Learning to code is the current gold rush.

High Pay:

 

 

Happiest Career:

No degree

Can learn for free

Maybe slide in office?

Ticketmaster Office


Slide 9 of 99

Trough Of Sorrow

Tutorial Hill


Slide 10 of 99

Manage Frustration

Consistency 

Taking Care Of Yourself

 


Slide 11 of 99

Don't let your dreams be dreams


Slide 12 of 99

Learning How To Learn

ACTIVE RECALL
SPACED REPETITION


Slide 13 of 99

Active Recall

Ali Abdaal: https://youtu.be/ukLnPbIffxE


Slide 14 of 99

Forgetting Curve*

https://intelalearning.wordpress.com


Slide 15 of 99

Resetting Forgetting Curve

https://www.pearsoned.com/three-simple-research-based-ways-to-ace-a-test


Slide 16 of 99

Spaced Repetition

Ali Abdaal: https://youtu.be/Z-zNHHpXoMM


Slide 17 of 99

You Are Not Alone!

!100Devs

leonnoel.com/100devs


Slide 18 of 99

THANK YOU

Microsoft Azure you a real one


Slide 19 of 99

Let's GIT IT ON


Slide 20 of 99

First, The Terminal


Slide 21 of 99

Terminal, Bash, Git Bash, Unix, Shell, CLI, cmd 


Slide 22 of 99

Slide 23 of 99

A place where you can type commands that cause actions


Slide 24 of 99

APPLE II

Emulator


Slide 25 of 99

CLI > GUI

Command Line Interface vs. Graphical User Interface


Slide 26 of 99

Let's Look

The Terminal


Slide 27 of 99

Common Commands


Slide 28 of 99

pwd

(print working director) shows where you are


Slide 29 of 99

mkdir

(make directory) create a folder


Slide 30 of 99

cd

(change directory) move to a different folder


Slide 31 of 99

cd ..

goes up a folder


Slide 32 of 99

cd ~

go back to home folder


Slide 33 of 99

touch

create a file


Slide 34 of 99

ls

shows you all the files in a folder


Slide 35 of 99

ls -l

shows you all the files in a folder with more info


Slide 36 of 99

ls -la

shows you all the files in a folder including hidden


Slide 37 of 99

rm

removes a file


Slide 38 of 99

rm -r <folder>

removes a folder


Slide 39 of 99

rm -rf <folder>

removes everything even protected files - be careful!


Slide 40 of 99

clear

clears what is currently being displayed


Slide 41 of 99

code filename

Opens file in VS Code

In VS Code:

view -> Command Palette ->

Shell Command: Install 'code' command in PATH


Slide 42 of 99

Access The Terminal?


Slide 43 of 99

Windows

Git Bash

https://gitforwindows.org

(for today)

WSL

(rest of program - will walk through during office hours)


Slide 44 of 99

Mac & GNU/Linux

Applications -> Terminal


Slide 45 of 99

Let's Code

Normal Folder Setup


Slide 46 of 99

!raffle


Slide 47 of 99

WHAT IS GIT?


Slide 48 of 99

While working on a really important Word Doc what did you do?


Slide 49 of 99

What if you wanted to work with someone else?


Slide 50 of 99

Git solves this problem when working with code

(save points)


Slide 51 of 99

Git is a version control system

 

A really fancy way of tracking changes


Slide 52 of 99

Git enables you to take "snapshots"

 

This has a deeper meaning, but similar to save points


Slide 53 of 99

Git enables you to take "snapshots" by making a commit

 

Just the term for creating that save point


Slide 54 of 99

Git enables you to roll back to previous "snapshots" (commits)

 

No more file -> save as -> folder132


Slide 55 of 99

!raffle


Slide 56 of 99

Install Git


Slide 57 of 99

Windows

Git Bash

https://gitforwindows.org

(for today)

WSL

(rest of program - will walk through during office hours)


Slide 58 of 99

MacOS

Install Homebrew:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install git

Slide 59 of 99

GNU / Linux

Debian / Ubuntu

 

$ sudo apt-get update 

$ sudo apt-get install git

Slide 60 of 99

Once Installed 

Setup User Name and Email

$ git config --global user.name "Leon Noel" 
$ git config --global user.email "leon@leonnoel.com"

Slide 61 of 99

Let's Install

Try Installing Git

*If you get stuck, office hours! (Saturday - 12pm EST)


Slide 62 of 99

!raffle


Slide 63 of 99

Basic Git Commands

 


Slide 64 of 99

git init

Creates a special folder to hold all of your snapshots (commits)


Slide 65 of 99

git add <file>

Adds file to staging area (not yet in that special folder)


Slide 66 of 99

git add *.html

Adds all html files to staging area (not yet in that special folder)


Slide 67 of 99

git add .

Adds everything to staging area (not yet in that special folder)


Slide 68 of 99

git status

Shows everything in staging area (not yet in that special folder)


Slide 69 of 99

git rm --cached index.html

Removes index.html from staging area 


Slide 70 of 99

git commit

 Adds everything in staging to the special folder as a snapshot

If you get stuck in vim:

i -> then type your message -> escape -> type :wq -> enter


Slide 71 of 99

git commit -m "text"

 Adds everything in staging to the special folder as a snapshot


Slide 72 of 99

git branch -M main

Changes name of staging area to main 


Slide 73 of 99

Let's Code

Make A Commit


Slide 74 of 99

!raffle


Slide 75 of 99

Want to try something without borking all your code


Slide 76 of 99

BRANCHES


Slide 77 of 99

git status

Find out if you are on main first


Slide 78 of 99

git branch <name>

Creates a new branch for you to make changes on without affecting the rest of your code!


Slide 79 of 99

git checkout <name>

Moves you to new branch where you can make changes without affecting the rest of your code!


Slide 80 of 99

Make Your Changes

 

Add your changes to staging

 

 

 

Commit Your Changes

git add .
git commit -m "changes made"

Slide 81 of 99

git checkout main

Moves you back to main branch


Slide 82 of 99

git merge <branch>

Adds changes from other branch to main


Slide 83 of 99

Let's Code

Use A Branch


Slide 84 of 99

!raffle


Slide 85 of 99

What is Github?


Slide 86 of 99

Local Vs. Remote


Slide 87 of 99

Not only backups,

but a whole suite of tools to work with other developers


Slide 88 of 99

Let's Make

A Github Account


Slide 89 of 99

!raffle


Slide 90 of 99

PUSH IT


Slide 91 of 99

Create A Github Repo


Slide 92 of 99

Instructions with each new repo


Slide 93 of 99

Let's Push

Our First Repo


Slide 94 of 99

!raffle


Slide 95 of 99

What are

Github Pages?


Slide 96 of 99

Let's Host

Host On Github Pages


Slide 97 of 99

Homework

Due (Tues. 4/5):

Do: Intro to Github

 https://aka.ms/learnwithleon​ 


Slide 98 of 99

https://aka.ms/learnwithleon 


Slide 99 of 99

!raffle