Intro to Version Control
Fall 2025
Readings for Next Week
What is ssh?
“SSH, or Secure Shell, is a cryptographic network protocol that enables secure access to a remote machine over the internet.”��Terms:
What is “the cloud”?
Intro to git
Today: Local Workflow
Intro to git
Git v. GitHub
8
How to Learn Git
The best way to learn git is to practice using git while working on a collaborative software project (like this class)!
There are also many great references you can draw from, including:
9
Simple Git Workflow: Solo Project (Today)
10
Solo Project Workflow (Simple)
11
Scenario: you want to make changes to a code repository that
lives on another computer / server (e.g., on GitHub)
Solo Project Workflow (Simple)
12
First, issue the git clone command. This downloads the code files (left) as well as a hidden .git folder of tracking files (middle), to your working directory (pwd)
Solo Project Workflow (Simple)
13
Note: In addition to the local repo, git has a concept of a “staging area.” �Files are ignored by git until they are staged.
Solo Project Workflow (Simple)
14
Use the git status command to tell you which of your files have been changed since the last commit (the current version of your codebase).
Solo Project Workflow (Simple)
15
To stage your changes (tell git which files you want to commit), use the git add command. You can add individual files (by path), or all changed files (use dot).
Solo Project Workflow (Simple)
16
When you’re ready to commit your changes (add them to the codebase), use the git commit command. All commits require a message describing the commit.
Solo Project Workflow (Simple)
17
Note that the added files are no longer highlighted, as they are now part of the code repository (changes are stored within the .git system files)
Solo Project Workflow (Simple)
18
To publish your changes back to the shared codebase (remote server), �use the git push command.
Simple Git Workflow: Solo Project Commands
19
clone | Copies a remote repository (e.g., one hosted on a GitHub server) onto your local machine (within your current directory). |
status | Tells you which of the files in your current directory are different from the latest commit in the repo. |
checkout -b �branchname | Creates and checks out a new branch (pointer) – to track subsequent changes that you don’t want on the previous branch. |
add | Stages the specified files to be committed |
log | Shows you the commit history |
commit | Saves a snapshot of your staged files at the moment the commit is issued. Each commit represents the state of your code at a particular moment in time. |
push | Uploads your commits to a remote repo |
pull | Downloads changes from a remote repo to your local repo |
Common Mistakes People Make
20
1. Avoid nested git repos
csci338
└── app
├── .git
├── .gitignore
├── README.md
└── class-exercises-spring2025
├── .git
├── .gitignore
├── README.md
└── src
21
BAD: reps are nested (class-exercises-spring2025 is a child of app).
Should app also be tracking the code in class-exercises-spring2025?
1. Side by Side Repos OK!
csci338
├── app
│ ├── .git
│ ├── .gitignore
│ ├── README.md
│ └── src
└── class-exercises-spring2025
├── .git
├── .gitignore
└── README.md
22
OK: Separate repos are not nested (in sibling directories)
2. Don’t forget to add a commit message
If you issue the git commit command without a commit message, it may open a vim editor and ask you to add your commit message via vim.
If this happens, you can either:
23
3. Don’t check in API keys, passwords, or dependencies
Use the .gitignore file to exclude files you don’t want under version control.
Files you typically want to exclude from version control:
24
Intro to Public / Private Keys
For GitHub Authentication
Authentication: What is a public/private key pair?
26
Public/private keys on Servers
27
Outline
28