![Page 1: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/1.jpg)
98-174 Modern Version Control With Git
Shannon LeeJonathan MiedelAlvin Wang
1
![Page 2: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/2.jpg)
Class Logistics● 15 Weeks
○ 13 Lectures○ Midterm + Final
● Class materials hosted on GitHub● For questions raise issues on GitHub or email
us ○ Shannon Lee [email protected]○ Jonathan Miedel [email protected]○ Alvin Wang [email protected]
2
![Page 3: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/3.jpg)
Continued● Class website
○ http://dogfalo.github.io/git-stuco/
3
![Page 4: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/4.jpg)
Grading● 6 Homeworks (30%)● 1 Midterm (25%)● 1 Final (35%)● Participation (10%)● Do not miss more than 3 classes
4
![Page 5: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/5.jpg)
Reasons to Use Version Control Software
● Sharing code● Maintain history of changes
5
![Page 6: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/6.jpg)
Problem Scenarios
6
![Page 7: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/7.jpg)
Email Echoing● Imagine you are sharing code with your team
members through email…
7
![Page 8: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/8.jpg)
Dropbox Duplicates● Picture two people working on the same file
they both save and…
8
![Page 9: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/9.jpg)
Investigating Integrity● Pretend a disgruntled employee tampers with
your companies code base making small bugs…
9
![Page 10: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/10.jpg)
Feature Fiasco● Recall, those times working on a new feature
before the deadline…
10
![Page 11: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/11.jpg)
Version Control● “The management of changes to documents,
computer programs, large web sites, and other collections of information” - Wikipedia
● Version Control Software (VCS) is any software that aids in the above tasks
11
![Page 12: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/12.jpg)
Advantages● Allows for parallel programing (code sharing)● Maintain multiple versions ● Backup work● Allow to view history● Revert changes● Speeds up development by allowing you to
make errors12
![Page 13: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/13.jpg)
Introduction to Git● Source code management software● Distributed workflow● Free and open source
13
![Page 14: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/14.jpg)
Features of Git● Operates faster than most competitors● Easy to use (particularly branching)● One of the most common in industry
○ As of April 2014, there were 247,103 repositories (https://www.openhub.net/repositories/compare)
● Offers data assurance
14
![Page 15: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/15.jpg)
Installing GitWindows: http://git-scm.com/download/winMac: http://git-scm.com/download/macLinux (Ubuntu): sudo apt-get install git
15
![Page 16: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/16.jpg)
Setting up Git
$ git config --global user.name "Alvin Wang"
$ git config --global user.email [email protected]
16
![Page 17: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/17.jpg)
Introduction to GitHub● github.com
○ Create a new account and login○ Sign up for GitHub!!!!○ Confirm your email
17
![Page 18: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/18.jpg)
Creating a Repo within GitHub
18
![Page 19: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/19.jpg)
How to Clone a Repositorygit clone - clones a repository (creates the local copy in the current directory)
19
$ git clone <git-repo-link>
![Page 20: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/20.jpg)
2048 Example
20
![Page 21: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/21.jpg)
How to Create a Repositorygit init - initializes a blank Git repository in the current directory$ git clone <git-repo-link>$ git clone <git-repo-link>
21
![Page 22: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/22.jpg)
Workflow Diagram
22
![Page 23: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/23.jpg)
git add● Takes a “snapshot” of
your files and puts it in the staging area
git add
23
![Page 24: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/24.jpg)
git add options● adds files to the index● git add <filename>● git add **/*.js (adds only javascript files)● git add . (adds all changes and additions in current
folder + subdirectories and adds deletions in 2.0+)● git add -A (same as git add --all, adds deletions too)● In git 2.0, git add -A and -u operate on the entire tree,
rather than just the current directory and subdirectories
24
![Page 25: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/25.jpg)
git status● git status - shows you what files in your
repository have been changed, deleted, or added
25
![Page 26: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/26.jpg)
git commit● Commits your staged
(git add) changes to your repository
git commitgit add
26
![Page 27: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/27.jpg)
Opening Issues on GithubFor this class we will handle questions by having you open issues on GitHub. This will help you get more familiar with the Git workflow.https://github.com/Git-Stuco/GitStucoClass
27
![Page 28: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/28.jpg)
Homework● Fill out survey (2 mins)
○ http://goo.gl/veEcTn● Clone the week 1 repo
○ https://github.com/Git-Stuco/Week1● Follow link in repository to video (5 mins)
28
![Page 29: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/29.jpg)
Next Week in 98-174Basic Git Commands● Clone in Detail● Commits as a concept● Push● git log● History of Git
29
![Page 30: 98-174 Modern Version Control With Gitdogfalo.github.io/git-stuco/week1/Week1.pdf · 98-174 Modern Version Control With Git Shannon Lee Jonathan Miedel Alvin Wang 1](https://reader033.vdocuments.us/reader033/viewer/2022042910/5f92f19516f9b4123f06bf46/html5/thumbnails/30.jpg)
Questions
30