Version Control and GitHub

contain

Version Control

  • Version control is a method of keeping track of changes to files over time
  • Why do you need it?
    • Do you have folders that look something like this?
      essay_v1.2 [20260101]
      essay_v1.2.1
      essay_20260103_edited_Prof_Li
      code_v1.2 (OLD!)
      code_v1.1 (DO NOT DELETE!)
      
    • Version control solves this!

Git

Git

  • The most widely used version control software is called Git.
  • You can run git locally, but it is better to use an online provider
  • Storing your version control online makes it much less likely to lose it!
  • Major providers for git:
    • GitHub (most popular)
    • GitLab
    • BitBucket

Why GitHub?

  • Version control: Track every change you make
  • Backup: Your code is safe in the cloud
  • Portfolio: Employers look at your GitHub profile
  • Collaboration: Work with others easily
  • Deployment: Host your websites for free!

Your GitHub is your coding resume. Start building it today.

GitHub Desktop

Setting Up for This Course

Repositories You'll Create

Repo Name Purpose URL (if deployed)
oim3690 Course work (exercises, logs)
username.github.io Personal website https://username.github.io
[project-name] Mini projects & Final Project https://username.github.io/[project-name]

Basic Workflow - First Time

  1. Open GitHub Desktop and select "New repository"
  2. Name your repository oim3690 (all lowercase, no spaces)
  3. Add a description, eg. "Course Work for OIM3690"
  4. Choose a location for the repository on your computer
    1. Make sure it is not inside any existing git folder
    2. Using the default location is usually fine
  5. Check "Initialize this repository with a README"
  6. Select the appropriate Git ignore type
  7. Click "Create repository" and make changes
  8. Commit changes and then "Publish repository" to GitHub.com

Basic Workflow - Working on Project

  • Pull the latest changes to sync your local repo
  • Edit files in your code editor (VS Code)
  • Pull again before committing (avoid conflicts)
  • Commit to save your changes locally
  • Push to upload your changes to GitHub

This is a basic workflow. Branching is recommended for larger projects.

Making Changes: Edit README.md

Open your oim3690 folder in VS Code and edit README.md:

# OIM3690 - Web Development

This is my course repository for OIM3690.

## About Me
- Name: Your Name

## Links
- [My Portfolio](https://username.github.io)

Markdown: # = heading, **bold**, *italic*, - = bullet, [text](url) = link

Commit and Push

Using GitHub Desktop:

  1. You'll see your changes listed
  2. Write a commit message that describes your changes
  3. Click "Commit to main"
  4. Click "Push origin"

Your changes are now on GitHub!

Gitignore File

There are things you don't want to sync with GitHub:

  • Data files
  • Credentials / secrets
  • "Byproduct" files (.DS_Store, node_modules/)

A .gitignore file allows you to select files that should be automatically ignored by git.

Create username.github.io and Deploy with GitHub Pages

Step 1: Create username.github.io (on GitHub)

This is your personal website repo:

  1. Go to github.com → Click "+" → "New repository"
  2. Name it exactly: yourgithubusername.github.io
  3. Add a description, eg. "My Personal Website"
  4. Make it Public
  5. Check "Add README"
  6. Click "Create repository"

This special repo name automatically enables GitHub Pages!

Step 2: Clone to Your Computer

Using GitHub Desktop:

  1. File → Clone Repository
  2. Select your repo
  3. Click "Code" -> "Open with GitHub Desktop"

Step 3: Enable GitHub Pages

  1. Go to your username.github.io repo on GitHub
  2. Settings → Pages (in left sidebar)
  3. Source: Deploy from a branch
  4. Branch: main / root
  5. Save

Wait a few minutes, then visit https://username.github.io

Learn More about Git & GitHub