CSci 3081W: Program Design and
Development
Week 1
Lecture 02 – Version Control and Git
Discord Demo and Commands -
● !help – shows all commands
● !queue join – adds you to the Queue
● !queue show – displays the Queue
● !queue leave – removes you from the Queue
TAs can use the following:
● !queue next – pops the first off of the Queue, now it’s their turn
● !queue next <int> - removes that indexed student from the Queue and then
it’s their turn
● !queue clear – clears the queue
● !queue add @username – adds the user to the Queue (corrects mistakes)
What is version control?
Also known as source control
Why is it important for development?
Talk to your neighbors
**This is a joke; you should learn git**
Definition
● Practice of tracking and managing
changes to software code
● Version control systems
○ Software tools like Git that manage changes to
source code over time
● What does it do?
○ Tracks every modification to the code in a
database – allows rollbacks and comparisons
Source Code
● The main code (main branch)
○ The crown jewel!
○ Protect it at all costs
● The source code should never
have bugs in it
* I like the Windows troubleshooting
program, this is just a joke
Protect the source code with Version Control
I’m unable to
let you talk to
my client at
this time
● Prevents code from “not
working anymore”
○ Due to integration errors or Domain
human errors Knowledge
Source code
Git – Version Control
Two Developers Example
● There exists a directory structure (file tree)
● One developer is writing new code with new functionality that relies on old
code
● The other is fixing an unrelated bug
Version control’s role is to track every change by each developer such that
concurrent work doesn’t conflict.
What if we don’t use version control?
What if we don’t use version control?
● Don’t know which developer made which change
● Don’t know if we created any integration failures
○ Leads to reworks and refactors
Version control is mandatory for all group work
● Version control is also helpful for solo projects
● You’ll do some version control work for lab 1
Version Control Systems (VCS)
● AKA Source Code Management (SCM) or Revision Control System (RCS)
● Most popular: Git
○ Git is technically a Distributed VCS (DVCS)
● Benefits:
○ Long term history for all changes for all files
○ Branching and Merging
○ Traceability
History of changes
● Includes edits as well as creation/deletion of files
● Includes author, date, and any notes that the author included
○ git commit –m “notes go here, can reach a higher character count through Git’s website”
● Enables us to go back to previous versions to find insight or causes for bugs
History of changes
Branching and Merging
Branching and Merging
● Team members must work concurrently!
○ But even solo projects can benefit from working on independent streams of changes
● Creating a branch in a VCS keeps multiple streams of work independent from
other
○ Also allows the merging of these branches together, enabling developers to make sure that
the changes in each branch don’t conflict
Branching and Merging
Traceability
● We can trace changes and connect them to project management and
software such as Atlassian’s Jira.
Version Control
The question isn’t “should I use version control?”. It’s “which one do I use?”.
○ We will use Git
○ Honorable mentions: Mercurial, SVN, CVS
Git
● Linus Torvalds, 2005 (also creator of Linux OS kernel)
● What does the D in DVCS really mean?
○ Rather than one place for the full version history, every developer's working copy of the code
is also a repository that can contain the full history of all changes
● In addition to being distributed, it’s also been designed with performance,
security, and flexibility in mind.
Git is the best choice for VCS
● Has the functionality, performance, security, and flexibility that most teams
need
● Most broadly adopted tool of its kind
○ Atlassian, CLion, Visual Studio Code, etc.
● Quality open source project
○ Plenty of documentation too!
Demo
git clone …
git pull
git add –A
git commit –m “small typo”
git push
Demo What about `git branch`, `git checkout –
b …`, `git checkout …`, `git abort`, …?
git clone …
git pull Git Cheat Sheet
git add –A Section 001:
https://canvas.umn.edu/courses/354981
git commit –m “small typo” /files?preview=33602459
Section 010:
git push
https://canvas.umn.edu/courses/355331
/files?preview=33602471
Git
Lab 1 - Git
Lab 1 is on Friday, January 20th
Due Thursday, January 26th at midnight
Workshop 1 – C++ Basics
Will be held in class on Tuesday, January 24th
Due Thursday, January 26th at midnight
requires lab 1 completion for last step of workshop
Zybooks 1 – C++ Basics
Due Sunday, January 22nd at midnight