01 03 Version Control
01 03 Version Control
● Due dates
○ Student survey “due” tonight
○ Due next Friday (released by 11:59 PM tonight):
■ D1 (discussion lab)
■ Q1 (Canvas quiz)
■ A1 (Assignment)
■ Group submission (1 form/group)
● Discussion Section today (this week is for finding group mates)
Version Control
Shannon E. Ellis, Ph.D
UC San Diego
Department of Cognitive Science
[email protected]
This sucks
Yup, this sucks too.
● Each person edits their own copy of the files and chooses when to share those
changes with the rest of the team.
● Thus, temporary or partial edits by one person do not interfere with another
person's work
v1 v2 v3
What is version control?
A way to manage the evolution of a set of files
File1_
v1 v2 v3
File2_
v1 v2 v3 v4 FINAL FINALfinal
What is version control?
A way to manage the evolution of a set of files
File2
What is version control?
A way to manage the evolution of a set of files
The set of files is
referred to as a
File1 repository (repo)
File2
https://insights.stackoverflow.com/survey/2017#work-version-control
git & GitHub
Terminal
GitHub
GUIs can be helpful when working with version control
Tracking
Returning to Exposure for
Collaboration others’ work
a safe state your work
Collaborate like you do with Google Docs
GitHub repository
Collaboration
Each person is making changes locally
(on their computer)
Make changes locally, while knowing a stable copy exists
Tracking
others’ work As a social platform, you
can see others’ work too!
A GitHub repo contains all the files
and folders for your project.
File1
repo repo
File2
GitHub is a remote
host. The files are
geographically distant
from any files on your
computer.
File1 When you first make a
repo copy onto your local
repo clone computer (read: laptop),
File2 you clone the repository.
File1
repo repo clone
File2
clo
ne
A commit tracks
who, what, and
when
File1
You can make commits more
repo repo informative by adding a
File2
commit message.
A commit tracks
who, what, and
when
File1
repo repo
File2
Shannon Ellis
3/28/21 3:28pm
fix typos in car and prof
File1
repo repo
File2
pus
h
Remember, you’re not the only one
working on this project though! You want
your teammates to have access to these
changes! You push these changes back to
the remote.
Shannon Ellis
3/28/21 3:28pm
fix typos in car and prof
File1
repo repo
File2
Shannon Ellis
3/28/21 3:28pm
fix typos in car and prof
Shannon Ellis
3/28/21 3:28pm
fix typos in car and prof
File1
To catch up, your teammate will have to
repo repo pull the changes from GitHub (remote)
File2
Shannon Ellis
3/28/21 3:28pm
fix typos in car and prof
Shannon Ellis
3/28/21 3:28pm
fix typos in car and prof
File1
repo repo
File2
pu
ll
Shannon Ellis
3/28/21 3:28pm
fix typos in car and prof
File1
repo repo cow.png
File2
pu
ll bunny.png
Shannon Ellis
3/28/21 3:28pm
fix typos in car and prof
File1
clone
Let’s recap real quick!
repo
local
File2
host
remote
host repo - set of files and folders for a project
remote - where the repo lives
clone - get the repo from the remote for the first time
pu
sh add - specify which files you want to stage (add to repo)
pu
commit
Review & Question Time
Version Controller I
You’ve been working with a team on a project in a repo. You’ve
made changes locally and you want to see them on the remote.
What do you do to get them on the remote?
A B C D E
clone remote merge pull push
Version Controller II
Your teammate has given you access to a GitHub repository to
work on a project together. You want to get them for the first
time on your computer locally.
What do you do to get the repo on your computer?
A B C D E
clone remote commit pull push
Each time you create a commit, git tracks
the changes made automatically.
is
ys
al
an
al
iv
rv
su
lis
m
8p ude
El
:0 l
n
15 nc
no
/2 to i
an
28
Sh
3/ ite
d
ed
of
pr
m and
lis
8p
El
:2 r
ca
n
13
no
n
/2 si
an
28 po
Sh
3/ ty
fix
s
fi le
tin
m
1a ysis
ar
1:1
M
l
11 na
la
/2 ed a
ge
26
An
3/ ud
cl
In
File1
File2
ne
repo am
alo
10 it
9:
M
8 m
n
/1 m
repo
vi
26 co
Ke
3/ al
iti
In
File1
By committing each time you make
repo repo changes, git allows you to time travel!
File2
File1
By committing each time you make
repo repo changes, git allows you to time travel!
File2
377dfcd00dd057542b112cf13be6cf1380b292ad
439301fe69e8f875c049ad0718386516b4878e22
377dfcd00dd057542b112cf13be6cf1380b292ad
File1 But...not everything is always linear.
repo repo Sometimes you want to try something out
and you’re not sure it’s going to work. This
File2
is where you’ll want to use a branch.
main branch
try-something-cool
It’s a good way to experiment. It’s
File1
pretty easy to get rid of a branch later
repo repo on should you not want to include the
File2 commits on that branch.
main branch
try-something-cool
But...what if you DO want to
File1
include the changes you’ve made
repo repo on your try-something-cool branch
File2 into the main branch?
main
try-something-cool
A merge allows you to combine
File1
the commits from a branch back
repo into the main.
repo
File2
main
try-something-cool
fork
someone your
else’s repo GitHub
commit
commit
main branch
branches allow you to
experiment. branches can be
try-something-cool abandoned or merged
main branch
branches allow you to
experiment. branches can be
try-something-cool abandoned or merged
fork
You can work on others’ repos
someone your by first forking their repository
else’s repo GitHub onto your GitHub
main branch
branches allow you to
experiment. branches can be
try-something-cool abandoned or merged
fork
You can work on others’ repos Pull requests allow you to make
someone your by first forking their repository specific edits to others’ repos
else’s repo GitHub onto your GitHub
To experiment within your own repo (test out a new feature, make
some changes you’re not sure will work)...
A B C D E
hash branch merge fork pull request
Version Controller IV
If you’ve made edits to someone else’s repo that you’re not a collaborator on…
A B C D E
hash branch merge fork pull request
Version Control: Practice
- Discussion Lab 1: Part 3
- Assignment 1: Part 1
- This will get you practice with git & GitHub
- Understand what you’re doing in the assignment!
- You may have to google, ask others, spend some time with this!
- Part II is a Python review; each part of this assignment is self-contained
- Do this part of the assignment ASAP
Note: You’re encouraged to
- git & Github == How to get the course lectures/materials
- Assignment 1 will have you fork the Lectures and Project repos
put projects on GitHub.
- You can keep the lectures up-to-date throughout the quarter Please do not put
- you’ll be using GitHub for your final projects assignments on GitHub.
COGS 108 Final Projects
The COGS 108 Final Project will give you the chance to explore
a topic of your choice and to expand your analytical skills. By
working with real data of your choosing you can examine
questions of particular interest to you.
- You are encouraged to work on a topic that matters to the world (your family, your neighborhood, a
state/province, country, etc).
- Taboo Topics: Movie Predictions/Recommendation System; YouTube Data Analysis, Kickstarter
success prediction/analysis,prediction of what makes a song popular on Spotify
Final Project: Objectives
● Identify the problems and goals of a real situation and dataset.
● Choose an appropriate approach for formalizing and testing the problems and goals, and be able to articulate the
reasoning for that selection.
● Implement your analysis choices on the dataset(s).
● Interpret the results of the analyses.
● Contextualize those results within a greater scientific and social context, acknowledging and addressing any
potential issues related to privacy and ethics.
● Work effectively to manage a project as part of a team.
Upcoming Project Components
Project Planning Survey (1%) - 1 submission per group (due Fri Week 2)
Project Review (5%) - Before Mon of week 3, your group will be assigned a previous COGS 108 project to
review; A google Form will be released to guide your thinking/discussion about and review of what a
previous COGS 108 group did for their project. (due Fri Week 3)
Project Proposal (8%) - a GitHub repo will be created for your group; ‘submit’ on GitHub (due Fri Week 4)
Project Proposal (8%)