Intro to Git & GitHub

Ha Khanh Nguyen (hknguyen)


1. What is Git?

1.1 Version Control System (VCS)

1.2 How is Git different from other VCS?

Common VCS Git
- delta-based version control - a stream of snapshots
- requires connection to databases or other computers on the network to access certain files - everything is stored locally
- allow limited operations without server connection - nearly every operation can be done locally

1.3 The 3 stages of Git


2. Creating a Git Repository

2.1 Initializing a repository in an existing directory

# macOS
cd Desktop/stat430/my-project

# Windows
cd Desktop/stat430/my-project
git init
git add -A
git commit -m "initial project version"
git remote add origin <your repo URL here>
git push origin master

2.2 Cloning an existing repository

git clone <url>

3. Recording Changes to the Repository

3.1 Checking the status of your repository

3.2 Tracking new files

git add -A
git add test.md

3.3 Staging modified files

3.4 Committing your changes

git commit -m "add test.md + changes hw1-soln"

3.5 Pushing the changes to remote repository

git push origin master


This lecture notes referenced materials in 1.3, 2.1 and 2.2 sections of Pro Git by Scott Chacon and Ben Straub.