Version Control and GitHub*

*inspired by Ties de Kok

Version Control

  • Version control is a method of keeping track of changes to a file or group of files over time, allowing users to access and revert to previous versions as needed.
  • 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

  • How to use version control?
    • The most widely used version control software is called git (Link)
    • 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
    • BitBucket
    • GitLab
  • It is widely accepted that GitHub is the best choice.

GitHub

  • GitHub is a web-based hosting service for version control using Git.
  • Why do I use GitHub?
    • Clean and easy to use interface
    • Native support for markdown rendering
    • Convenient GitHub Desktop application
    • Free and unlimited private repositories for everyone
    • Integration with GitHub Actions for CI/CD
    • GitHub Copilot: AI-powered code suggestions
    • Bonus feature: ability to host webpages for free with GitHub Pages.

Your GitHub profile is your resume. Start building it now.

GitHub Desktop

Basic Workflow - First Time*

  1. Open GitHub Desktop and select "New repository"
  2. Name your repository oim3640 (all lowercase, no spaces)
  3. Add a description, eg. "Course Work for OIM3640"
  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 Python as Git ignore type
  7. Click "Create repository" and "Publish repository" to GitHub.com

*Note: You can also create a repository on GitHub.com website and then clone it to your computer and work on it.

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 oim3640 folder in VS Code and edit README.md:

# OIM3640

This is my course repository for OIM3640.

## About Me
- Name: Your Name
- Concentration: Your Concentration
- Interests: Your Interests ...

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

Gitignore file

  • There are a lot of things you don't want to sync with GitHub:

    • Data
    • Credentials
    • "Byproduct" files
  • A .gitignore file allows you to select files that should be automatically ignored by git.

Learn More about Git & GitHub