CSE 163
Intro to Git�
Arpan Kapoor�
Announcements
2
Who am I?
3
Version Control
What are its benefits and why do we use it?
4
What is Git?
5
Git vs. GitHub, GitLab, etc.
6
Repositories
7
Repositories
8
Developer 1
Developer 2
Remote Repository
Push/Pull Changes
9
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.
“
Git Commands
Usage: git status
10
Git Commands
Usage: git add <file1> <file2> ...
11
Git Commands
Usage: git commit -m “commit msg”
12
13
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
“
More Git Commands
Usage: git clone <URL>
14
More Git Commands
Usage: git push
15
More Git Commands
Usage: git pull
16
17
Branching and Diverging Branches
A
B
C
D
E
NOTE: The pointer from one commit to another points to the previous commit, so the arrows go back in time. ‘A’ is the first commit, and ‘E’ is the most recent commit.
This visualization illustrates two scenarios:
“
“Undo” Git Commands
Usage: git reset HEAD filename
18
“Undo” Git Commands
Usage: git revert HEAD
19
Discuss!
Now that we have a basic understanding of Git, how does it compare to other version control systems you’ve used like Docs, Slides?
20
21
Demo!
Before Next Time
Next Time
22
Extra Resources
23