1 of 19

CSE 163

Version Control

Arpan Kapoor�Summer 2026

slido.com

#2348882

2 of 19

Announcements

  • Programming Practice 4 due tomorrow at 11:59 PM
  • Project EDA due Sunday, August 2nd at 11:59 PM

slido.com

#2348882

3 of 19

Version Control

What are its benefits and why do we use it?

  • Allows for collaboration
  • Revert mistakes easily
  • Accountability

3

slido.com

#2348882

4 of 19

What is Git?

4

4

slido.com

#2348882

  • Created by Linus Torvalds in 2005
  • Desired an efficient version control system that supported large scale coding projects
    • couldn’t find one, so he made it!
  • Centralized vs. distributed version control:
    • Centralized: a central server processes, maintains, and shares all changes.
    • Distributed: all users maintain a working copy (a local repository) on their own machine.

5 of 19

Git vs. GitHub, GitLab, etc.

5

slido.com

#2348882

  • Git is the tool that allows this version control system to function locally.

  • GitHub and Gitlab are hosting services for git’s remote functionalities (hosting remote repositories).

6 of 19

Repositories

  • A repository, commonly referred to as a repo is a location that stores a copy of all files.
  • Can be either local, or remote (online/non-local)
  • What should be inside of a repository?
    • Source code files (i.e. .py files, .ipynb files, etc)
    • Images, general resources files
    • README.md files and notes
  • What should not be inside of a repository (generally)
    • Executables or generated files
    • Data (i.e. .csv files, .shp files, etc.) or files that take up a lot of space

6

slido.com

#2348882

7 of 19

Repositories

  • With git, everyone working on the project has a complete version of the repository.
    • There is a remote repository, which is the central repository
    • Remote repositories are hosted on services like GitHub or Gitlab
    • Everyone has a local copy of the repository, which is what we use to send our own changes to the remote repository.

7

slido.com

#2348882

Developer 1

Developer 2

Remote Repository

Push/Pull Changes

8 of 19

Integrated Development Environments

  • Or IDEs for short, are software that allows us to write and execute code!
  • VSCode, is an example of one, and the one we recommend you use as a more robust alternative to writing code in JupyterHub
  • Follow along with our software setup guide
    • Virtual environments will be covered on �Friday, so don’t worry too much about �that!

8

slido.com

#2348882

9 of 19

Terminal Review

  • A terminal is a text-based interface that allows you to interact with your operating system
  • Using a terminal in an integrated development environment like VSCode is no different than using your computer’s own terminal!
    • Note: the JupyterHub terminal does not interact with your computer’s operating system, it’s talking to the remote computer that you’re connected to on JupyterHub’s server!

9

slido.com

#2348882

10 of 19

Terminal Review

  • Common terminal commands include:
    • cd: changes the working directory given a directory or path
      • ‘.’ refers to the current directory, ‘..’ refers to the previous directory
    • pwd: prints the current working directory
    • ls: lists the contents of the current working directory
    • python: used to run Python (.py) files
  • To run git commands, you’ll first need to install git on your computer
    • https://git-scm.com/

10

slido.com

#2348882

11 of 19

11

slido.com

#2348882

The 4 Stages of Git

Working Directory

Working changes in your development environment

Staging Area

Changes you’re preparing to commit

Local Repository

Local copy of the repository with your committed changes

git stage

git commit

Remote Repository

Remote shared repository on Github, Gitlab, etc.

12 of 19

Git Commands

  • init
  • status
  • add
  • commit

Usage: git init

  • Creates a new local repository in your current �working directory
  • Alternatively (and preferably), create a remote repository online, then clone it to your local machine (more on this later!)

12

slido.com

#2348882

13 of 19

Git Commands

  • init
  • status
  • add
  • commit

Usage: git status

  • Shows info about current status of your working directory and staging area
  • Indicates the following:
    • uncommitted changes in working directory
    • committed changes in the staging area
    • new, untracked files
    • branch information
    • any relevant conflicts

13

slido.com

#2348882

14 of 19

Git Commands

  • init
  • status
  • add
  • commit

Usage: git add <file1> <file2> ...

  • Moves files from your working directory to the staging area
  • Can be used to add multiple files in one go, or just one at a time
  • Also accepts the relative path of a file if not currently within the file’s directory

14

slido.com

#2348882

15 of 19

Git Commands

  • init
  • status
  • add
  • commit

Usage: git commit -m “commit msg”

  • Moves files from the staging area to your local repository by packaging them as commits
  • “-m” flag indicates the inclusion of a single-line commit message within the command
  • Alternatively, use “git commit” to open a text editor to write longer commit messages
  • Best practice is to commit frequently!

15

slido.com

#2348882

16 of 19

16

slido.com

#2348882

The 4 Stages of Git

Working Directory

Staging Area

Local Repository

Working changes in your development environment

Changes you’re preparing to commit

Local copy of the repository with your committed changes

Remote Repository

Remote shared repository on Github, Gitlab, etc.

git stage

git commit

git push

git pull

17 of 19

More Git Commands

  • clone
  • push
  • pull

Usage: git clone <URL>

  • Used to clone an already existing remote repository onto your local machine
  • For private repositories, requires authentication (i.e. via SSH keys, etc.)
  • After cloning, you can collaborate with others who have access to the remote repository!

17

slido.com

#2348882

18 of 19

More Git Commands

  • clone
  • push
  • pull

Usage: git push

  • Used to push changes from your local repository to the remote repository
  • Once you push your changes, they are visible for all others to see!

18

slido.com

#2348882

19 of 19

More Git Commands

  • clone
  • push
  • pull

Usage: git pull

  • Used to update your working directory with changes from the remote repository
  • Combination of the commands “fetch” and “merge”
    • Fetch retrieves the changes from the remote repository to your local repository
    • Merge combines the changes in your local repository with your working directory

19

slido.com

#2348882