BACK TO SCHOOL SALE! | 20% off ALL ACCESS to One Month ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

Hide

Set Up Git

Week 1: Your First Rails Application ยท Lesson 2 ยท


Git lets you save different versions of your files to make it easier to work with a team, or to go back to previous saves.

Shutting Down the Server

Exit the server with Control + C.

Now http://localhost:3000 will give you an error if you try to go there.

Using Git to Save Your Code

Check to make sure you have Git set up

$ git --version
git version 2.X.X

Configuring Git on a New Computer

You only do this once per computer

$ git config --global user.name "Mattan Griffel" # Replace what's in the quotes with your name
$ git config --global user.name
Mattan Griffel
$ git config --global user.email "mattan@onemonth.com" # Replace what's in the quotes with your email
$ git config --global user.email
mattan@onemonth.com

Setting Up Git in a New Project

You only you do this once in the beginning of every new project

$ git init

Saving Your Code in Git

You'll run these commands a lot:

$ git status # Shows you what files you are tracking (or not tracking)
$ git add -A
$ git commit -m "Initial commit"