SlideShare a Scribd company logo
1 of 177
Download to read offline
Git
Explore nature
in Canada.
See more
Home Contact Abbout
👩🏼‍💻
Explore nature
in Canada.
See more
Home Contact
Explore nature
in Canada.
See more
Home Contact
www.mywebsite.com local
👩🏼‍💻
Abbout Abbout
Explore nature
in Canada.
See more
Home Contact
Explore nature
in Canada.
See more
Home Contact About
www.mywebsite.com local
👩🏼‍💻
Visit Canada’s lakes and mountains.
Abbout
Explore nature
in Canada.
See more
Home Contact
Explore nature
in Canada.
See more
Home Contact About
www.mywebsite.com local
👩🏼‍💻
Visit Canada’s lakes and mountains.
Abbout
🤦🏼‍
♀️
Git
Git
Content tracker
Distributed Version Control System
Hosted state of your website
New state of your website with
the local changes
Explore nature
in Canada.
See more
Home Contact Abbout
Explore nature
in Canada.
See more
Home Contact About
Visit Canada’s lakes and mountains.
Added front page
Fixed buttons in navigation
Added sub title
Changed background image
Fixed button CSS @max
@sara
@tim
@max
@sara
🙋🏽‍
♂️
🙋🏽‍
♂️
🙋🏼‍
♀️
🙋🏼‍
♀️
💁🏼‍
♂️
10.24AM
10.45AM
11.05AM
11.15AM
12.23AM
Added front page
Explore nature
in Canada.
See more
Home Contact Abbout
Explore nature
in Canada.
See more
Home Contact Abbout
Visit Canada’s lakes and mountains.
Change background
Added front page
Explore nature
in Canada.
See more
Home Contact Abbout
Explore nature
in Canada.
See more
Home Contact Abbout
Visit Canada’s lakes and mountains.
Change background
Added front page
Explore nature
in Canada.
See more
Home Contact Abbout
Explore nature
in Canada.
See more
Home Contact Abbout
Visit Canada’s lakes and mountains.
Change background
Fixed button typo
Explore nature
in Canada.
See more
Home Contact About
Added front page
Explore nature
in Canada.
See more
Home Contact Abbout
Explore nature
in Canada.
See more
Home Contact Abbout
Visit Canada’s lakes and mountains.
Change background
Explore nature
in Canada.
See more
Home Contact About
www.mywebsite.com
Fixed button typo
Explore nature
in Canada.
See more
Home Contact About
Added front page
Explore nature
in Canada.
See more
Home Contact Abbout
Explore nature
in Canada.
See more
Home Contact Abbout
Visit Canada’s lakes and mountains.
Change background
Explore nature
in Canada.
See more
Home Contact About
www.mywebsite.com
Remote Repository
Local Repository
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
👩🏽
Remote Repository
Local Repository Local Repository
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
👩🏽 👱🏾‍
♂️
Remote Repository
Local Repository Local Repository
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
👩🏽 👱🏾‍
♂️
Remote Repository
Local Repository Local Repository
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
<p>This is some more text!</p>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
👩🏽 👱🏾‍
♂️
Remote Repository
Local Repository Local Repository
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
<p>This is some more text!</p>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
👩🏽 👱🏾‍
♂️
<html>
<body>
<h1>My Website!</h1>
<p>This is some more text!</p>
</body>
</html>
Remote Repository
Local Repository Local Repository
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
<p>This is some more text!</p>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
👩🏽 👱🏾‍
♂️
<html>
<body>
<h1>My Website!</h1>
<p>This is some more text!</p>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
<p>This is some more text!</p>
</body>
</html>
<html>
<body>
<h1>My Website!</h1>
<p>This is some more text!</p>
</body>
</html>
Working Area Staging Area Committed Files
Local Repository
commit
Added front page
Fixed buttons in navigation
Added sub title
Changed background image
Fixed button CSS @max
@sara
@tim
@max
@sara
🙋🏽‍
♂️
🙋🏽‍
♂️
🙋🏼‍
♀️
🙋🏼‍
♀️
💁🏼‍
♂️
commit
commit
commit
commit
Working Area Staging Area Committed Files
Local Repository
story1.txt
story2.txt
Initialize Git Repo
bash
$ git init
Initialized empty Git repository in
/Users/lydiahallie/Desktop/myproject/.git/
bash
$ ls -a
. .. .git
bash
$ touch story1.txt
$ echo "This is a beautiful story" >> story1.txt
bash
$ git status
On branch master
No commits yet
Untracked files:
story1.txt
nothing added to commit but untracked files present
Working Area Staging Area Committed Files
story1.txt
bash
$
Working Area Staging Area Committed Files
story1.txt
bash
$ git add story1.txt
Working Area Staging Area Committed Files
story1.txt
bash
$ git commit -m "Added first story"
Added first story @me 🙋🏼‍
♀️
Git log
bash
$ git log
commit 67c833e3…ecb7df62f (HEAD -> master)
Author: John Doe <john@doe>
Date: Sun Jun 14 14:45:07 2020 -0700
Added first story
bash
$ git log —-oneline
67c833e (HEAD -> master) Added first story
Initializing a remote repo
https://.../.../[name].git
Connection String
bash
$ git remote add origin https://.../.../[name].git
Working Area Staging Area Committed Files
Local Repository
Working Area Staging Area Committed Files
Local Repository
Remote Repository
https://.../.../[name].git
bash
$ git remote -v
origin https://.../.../[name].git (fetch)
origin https://.../.../[name].git (push)
Pushing
Remote Repository
Local Repository
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
👩🏽
<html>
<body>
<h1>My Website!</h1>
</body>
</html>
bash
$ git push origin master
Added first story @me 🙋🏼‍
♀️
Added second story @me 🙋🏼‍
♀️
Added third story @me 🙋🏼‍
♀️
Added fourth story @me 🙋🏼‍
♀️
Added fifth story @me 🙋🏼‍
♀️
remote
local
Cloning
bash
$ git clone <ssh link>
bash
$ git clone git@github.com:….…git
Cloning into 'remote-repo'...
remote: Enumerating objects: 59, done.
remote: Counting objects: 100% (59/59), done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 2948 (delta 28), reused 18 (delta 6)
Receiving objects: 100% (2948/2948), 1.93 MiB | 2.53 MiB/s, done.
Resolving deltas: 100% (1526/1526), done.
bash
$ cd remote-repo
$ git log
commit 67c833e3…ecb7df62f (HEAD -> origin/master)
Author: John Doe <john@doe>
Date: Sun Jun 14 14:45:07 2020 -0700
Added first story
Branches
Added first story @me 🙋🏼‍
♀️
Added second story @me 🙋🏼‍
♀️
Added third story @me 🙋🏼‍
♀️
Added fourth story @me 🙋🏼‍
♀️
Added fifth story @me 🙋🏼‍
♀️
Added fourth story @me 🙋🏼‍
♀️
Added fifth story @me 🙋🏼‍
♀️
Fixed fourth story @friend
👨🏼‍💻
Added sixth story
👨🏼‍💻
Added seventh story @friend
👨🏼‍💻
@friend
Added fifth story @me 🙋🏼‍
♀️
Added fourth story @me 🙋🏼‍
♀️
Added fifth story @me 🙋🏼‍
♀️
Fixed fourth story @friend
👨🏼‍💻
Added sixth story
👨🏼‍💻
Added seventh story @friend
👨🏼‍💻
@friend
Added fifth story @me 🙋🏼‍
♀️
Merged branch Dave @friend 👨🏼‍💻
Added cool new feature
🙋🏼‍
♀️
Updated tests
🙋🏼‍
♀️
Added cool new feature
🙋🏼‍
♀️
Updated tests
🙋🏼‍
♀️
bash
$ git checkout -b sarah
Switched to a new branch 'sarah'
$ git branch
master
* sarah
Added first story @me 🙋🏼‍
♀️ master sarah
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
master sarah
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master max
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master max
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻 Added third story @max 🧔🏻
max
master
Merging
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
Added third story @max 🧔🏻
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
Added third story @max 🧔🏻
bash
$ git checkout master
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
Added third story @max 🧔🏻
bash
$ git checkout master
$ git merge max
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
bash
$ git checkout master
$ git merge max
Added third story @max 🧔🏻
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
bash
$
Added third story @max 🧔🏻
git merge sarah
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
bash
$
Added third story @max 🧔🏻
git merge sarah
sarah master
Merge sarah into master @sarah 👩🏽‍💻
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
bash
$
Added third story @max 🧔🏻
git merge sarah
sarah master
Merge sarah into master @sarah 👩🏽‍💻
Merge Conflicts
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
Added third story @max 🧔🏻
sarah master
Merge sarah into master @sarah 👩🏽‍💻
sarah
Started fourth story @sarah 👩🏽‍💻
master
max
Started fourth story @max 🧔🏻
## Fourth Story
This is Max’s version
of the fourth story!
## Fourth Story
This is Sarah’s version
of the fourth story!
fourth_story.md fourth_story.md
Some extra stuff Sarah
added
sarah
Started fourth story @sarah 👩🏽‍💻
master
max
Started fourth story @max 🧔🏻
sarah
Started fourth story @sarah 👩🏽‍💻
master max
Started fourth story @max 🧔🏻
sarah
Started fourth story @sarah 👩🏽‍💻
master max
Started fourth story @max 🧔🏻
## Fourth Story
## Fourth Story
This is Sarah’s version
of the fourth story!
fourth_story.md fourth_story.md
This is Max’s version
of the fourth story!
## Fourth Story
<<<<<<<< HEAD
This is Sarah’s version
=======
>>>>>>> max
fourth_story.md
Some extra stuff Sarah
added
This is Max’s version
of the fourth story!
## Fourth Story
<<<<<<<< HEAD
This is Sarah’s version
=======
>>>>>>> max
fourth_story.md
This is Max’s version
Some extra stuff Sarah
added
of the fourth story!
sarah
Started fourth story @sarah 👩🏽‍💻
master max
Started fourth story @max 🧔🏻
bash
$ git add fourth_story.txt
$ git merge
sarah
Started fourth story @sarah 👩🏽‍💻 Started fourth story @max 🧔🏻
bash
$ git add fourth_story.txt
$ git merge
Merge max into master @max 🧔🏻
master max
Pull Request
🧔🏻
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
Added third story @max 🧔🏻
origin/master
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
Added third story @max 🧔🏻
bash
$ git push origin sarah
origin/sarah
origin/master
Fetching and Pulling
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
Added third story @max 🧔🏻
origin/sarah
origin/master
bash
$ git fetch origin master
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
Added third story @max 🧔🏻
origin/sarah
origin/master
bash
$ git merge origin/master
bash
$ git pull origin master
Added first story @me 🙋🏼‍
♀️
sarah
Added second story @sarah 👩🏽‍💻
master
max
Added third story @max 🧔🏻
origin/sarah
origin/master
Rebasing
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
bash
$
Added third story @max 🧔🏻
git merge sarah
sarah master
Merge sarah into master @sarah 👩🏽‍💻
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
bash
$
Added third story @max 🧔🏻
git rebase sarah
sarah master
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
bash
$
Added third story @max 🧔🏻
git rebase sarah
sarah
master
bash
$
🧔🏻
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
Added third story @max 🧔🏻
sarah master
89fej
7wtf78
jf79w
bash
$
🧔🏻
git merge sarah
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
Added third story @max 🧔🏻
sarah master
89fej
7wtf78
jf79w
Merge sarah into master @sarah 👩🏽‍💻
90f7d
bash
$ git rebase sarah
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
Added third story @max 🧔🏻
sarah master
89fej
7wtf78
jf79w
bash
$ git rebase sarah
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
max
Added third story @max 🧔🏻
sarah
master
89fej
7wtf78
890sf
Interactive Rebasing
Added second story @sarah 👩🏽‍💻
bash
$
sarah
Changes to second story @sarah 👩🏽‍💻
Oops more changes to second story @sarah 👩🏽‍💻
More changes to second story @sarah 👩🏽‍💻
6a6f6
8ad5d
aaba5
fb9f1
Added second story @sarah 👩🏽‍💻
bash
$ git rebase -i
sarah
Changes to second story @sarah 👩🏽‍💻
Oops more changes to second story @sarah 👩🏽‍💻
More changes to second story @sarah 👩🏽‍💻
HEAD~4
6a6f6
8ad5d
aaba5
fb9f1
bash
$ git rebase -i HEAD~4
pick
pick
pick
aaba5e7 Changes to second story
8ad5d7b Oops more changes to second story
6a6f68b More changes to second story
pick fb9f191 Added second story
# Rebase dc9ad3c..6a6f68b onto 6a6f68b (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
bash
$ git rebase -i HEAD~4
pick
pick
pick
aaba5e7 Changes to second story
8ad5d7b Oops more changes to second story
6a6f68b More changes to second story
pick fb9f191 Added second story
# Rebase dc9ad3c..6a6f68b onto 6a6f68b (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
bash
$ git rebase -i HEAD~4
pick fb9f191 Added second story
# Rebase dc9ad3c..6a6f68b onto 6a6f68b (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
squash
squash
squash
aaba5e7 Changes to second story
8ad5d7b Oops more changes to second story
6a6f68b More changes to second story
Added second story @sarah 👩🏽‍💻
bash
$ git rebase -i
sarah
Changes to second story @sarah 👩🏽‍💻
Oops more changes to second story @sarah 👩🏽‍💻
More changes to second story @sarah 👩🏽‍💻
HEAD~4
6a6f6
8ad5d
aaba5
fb9f1
Added second story @sarah 👩🏽‍💻
bash
$ git rebase -i
sarah
81h48
HEAD~4
Changes to second story
Oops more changes to second story
More changes to second story
Cherry-Picking
bash
$
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
89fej
jf79w
8ad5d
aaba5
Changed first story @sarah 👩🏽‍💻
Changed second story @sarah 👩🏽‍💻
bash
$
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
89fej
jf79w
8ad5d
aaba5
Changed first story @sarah 👩🏽‍💻
Changed second story @sarah 👩🏽‍💻
git cherry-pick aaba5
bash
$
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
89fej
jf79w
8ad5d
aaba5
Changed first story @sarah 👩🏽‍💻
Changed second story @sarah 👩🏽‍💻
git cherry-pick aaba5
89hd8
bash
$
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
89fej
jf79w
8ad5d
aaba5
Changed first story @sarah 👩🏽‍💻
Changed second story @sarah 👩🏽‍💻
git cherry-pick aaba5
89hd8
bash
$ echo "This is my first story" >> first_story.txt
Porcelain Commands
git add
git status
git commit
git stash
…
Plumbing Commands
git hash-object
git ls-files
git rev-parse
git ls-remote
…
bash
$ git hash-object first_story.txt
bea8d7fee8e7b11c2235ca623935e6ccccd8bac3
bash
$ git hash-object first_story.txt
bea8d7fee8e7b11c2235ca623935e6ccccd8bac3
bash
$ git add first_story.txt
$ git commit -m "First story"
$ ls ./.git/objects
26 be a0 info pack
bash
$ git add first_story.txt
$ git commit -m "First story"
$ ls ./.git/objects
26 be a0 info pack
$ ls ./.git/objects/be
a8d7fee8e7b11c2235ca623935e6ccccd8bac3
bash
$ git add first_story.txt
$ git commit -m "First story"
$ ls ./.git/objects
26 be a0 info pack
$ ls ./.git/objects/be
a8d7fee8e7b11c2235ca623935e6ccccd8bac3
$ git cat-file -p bea8d7
"This is my first story"
bash
$ git cat-file -p 4cdf4
tree 2ea7de7ff3bd48cbb020b215b36feb67ee7f9a30
parent f4e830485cc852686cf115e75a79cbb41a0de713
author Lydia Hallie <e@mail.com> 1594547678 +0200
committer Lydia Hallie <e@mail.com> 1594547678 +0200
First story
bash
$ git cat-file -p 4cdf4
tree 2ea7de7ff3bd48cbb020b215b36feb67ee7f9a30
parent f4e830485cc852686cf115e75a79cbb41a0de713
author Lydia Hallie <e@mail.com> 1594547678 +0200
committer Lydia Hallie <e@mail.com> 1594547678 +0200
First story
Git Object Contents
commit
tree
blob
Added second story @sarah 👩🏽‍💻
Changes to second story @sarah 👩🏽‍💻
Added third story @sarah 👩🏽‍💻
8ad5d
aaba5
fb9f1
Added second story @sarah 👩🏽‍💻
Changes to second story @sarah 👩🏽‍💻
Added third story @sarah 👩🏽‍💻
8ad5d
aaba5
fb9f1
Added second story @sarah 👩🏽‍💻
Changes to second story @sarah 👩🏽‍💻
Added third story @sarah 👩🏽‍💻
8ad5d
aaba5
fb9f1
commit
commit
aaba5
fb9f1
tree
tree
tree
blob
blob
blob
blob
commit
8ad5d
commit
commit
commit
8ad5d
aaba5
fb9f1
tree
tree
tree
blob
blob
blob
blob
commit
commit
commit
8ad5d
aaba5
fb9f1
tree
tree
tree
blob
blob
blob
blob
commit
commit
commit
8ad5d
aaba5
fb9f1
tree
tree
tree
blob
blob
blob
blob
Resetting and Reverting
Added second story @sarah 👩🏽‍💻
bash
$
sarah
Changes to second story @sarah 👩🏽‍💻
Added third story @sarah 👩🏽‍💻
8ad5d
aaba5
fb9f1
Added second story @sarah 👩🏽‍💻
bash
$
sarah
Changes to second story @sarah 👩🏽‍💻
Added third story @sarah 👩🏽‍💻
8ad5d
aaba5
fb9f1
git revert 8ad5d
+ third_story.md
Added second story @sarah 👩🏽‍💻
bash
$
sarah
Changes to second story @sarah 👩🏽‍💻
Added third story @sarah 👩🏽‍💻
8ad5d
aaba5
fb9f1
git revert 8ad5d
Reverted “Added third story” @sarah 👩🏽‍💻
890hs
- third_story.md
+ third_story.md
Added second story @sarah 👩🏽‍💻
bash
$
sarah
Changes to second story @sarah 👩🏽‍💻
Added third story @sarah 👩🏽‍💻
8ad5d
aaba5
fb9f1
Added second story @sarah 👩🏽‍💻
bash
$
sarah
Changes to second story @sarah 👩🏽‍💻
Added third story @sarah 👩🏽‍💻
8ad5d
aaba5
fb9f1
git reset —-soft HEAD~1
Added second story @sarah 👩🏽‍💻
sarah
Changes to second story @sarah 👩🏽‍💻
aaba5
fb9f1
bash
$ git reset —-soft HEAD~1
Added second story @sarah 👩🏽‍💻
bash
$
sarah
Changes to second story @sarah 👩🏽‍💻
aaba5
fb9f1
$ git status
On branch sarah
Changes to be committed:
added: third_story.md
git reset —-soft HEAD~1
Added second story @sarah 👩🏽‍💻
bash
$
sarah
Changes to second story @sarah 👩🏽‍💻
Added third story @sarah 👩🏽‍💻
8ad5d
aaba5
fb9f1
git reset —-hard HEAD~1
Added second story @sarah 👩🏽‍💻
sarah
Changes to second story @sarah 👩🏽‍💻
aaba5
fb9f1
bash
$ git reset —-hard HEAD~1
Added second story @sarah 👩🏽‍💻
bash
$
sarah
Changes to second story @sarah 👩🏽‍💻
aaba5
fb9f1
$ git status
On branch sarah
Nothing to commit
git reset —-hard HEAD~1
Git Stash
Working Area Staging Area Committed Files
bash
$ git stash
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
+ third_story.md
Working Area Staging Area Committed Files
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
Stash
bash
$ git stash
+ third_story.md
Working Area Staging Area Committed Files
+ third_story.md
Stash
WIP on sarah:
f4e8304 Added second story
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
bash
$ git stash
Working Area Staging Area Committed Files
+ third_story.md
Stash
WIP on sarah:
f4e8304 Added second story
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
bash
$ git stash pop
Working Area Staging Area Committed Files
+ third_story.md
Stash
WIP on sarah:
f4e8304 Added second story
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
bash
$ git stash pop
Working Area Staging Area Committed Files Stash
WIP on sarah:
f4e8304 Added second story
Added first story @me 🙋🏼‍
♀️
Added second story @sarah 👩🏽‍💻
sarah
bash
$ git stash pop
+ third_story.md
+ third_story.md
Stash
bash
$ git stash
Staging Area
+ third_story.md
Stash
bash
$ git stash
Staging Area
Stash
bash
$
+ fourth_story.md
Staging Area
git stash
+ third_story.md
Stash
bash
$ git stash
+ fourth_story.md
Staging Area
+ third_story.md
Stash
bash
$
Staging Area
git stash
+ fourth_story.md
+ third_story.md
+ fifth_story.md
Stash
bash
$ git stash
+ fifth_story.md
Staging Area
+ fourth_story.md
+ third_story.md
bash
$ git stash list
stash@{0}: WIP on sarah: f4e8304 Added second story
stash@{1}: WIP on sarah: f4e8304 Added second story
stash@{2}: WIP on sarah: f4e8304 Added second story
bash
$ git stash list
stash@{0}: WIP on sarah: f4e8304 Added second story
stash@{1}: WIP on sarah: f4e8304 Added second story
stash@{2}: WIP on sarah: f4e8304 Added second story
$ git stash show stash@{1}
fourth_story.md | 1 +
1 file changed, 1 addition(+)
bash
$ git stash list
stash@{0}: WIP on sarah: f4e8304 Added second story
stash@{1}: WIP on sarah: f4e8304 Added second story
stash@{2}: WIP on sarah: f4e8304 Added second story
$ git stash show stash@{1}
fourth_story.md | 1 +
1 file changed, 1 addition(+)
$ git stash pop stash@{1}
Dropped stash@{1} (2cfe…)
Git-for-new-comers-and-absolute-beginners.pdf

More Related Content

Similar to Git-for-new-comers-and-absolute-beginners.pdf

Similar to Git-for-new-comers-and-absolute-beginners.pdf (9)

Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
Artdm171 Week3 Tags Group Projects
Artdm171 Week3 Tags Group ProjectsArtdm171 Week3 Tags Group Projects
Artdm171 Week3 Tags Group Projects
 
Php by tanbircox
Php by tanbircoxPhp by tanbircox
Php by tanbircox
 
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagiosMonitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
 
Bangla html
Bangla htmlBangla html
Bangla html
 
Introducing ElasticSearch - Ashish
Introducing ElasticSearch - AshishIntroducing ElasticSearch - Ashish
Introducing ElasticSearch - Ashish
 
Git session day 1
Git session day 1Git session day 1
Git session day 1
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
 
Dmitry sharkov - Maturing Your Cucumber Suites
Dmitry sharkov   - Maturing Your Cucumber SuitesDmitry sharkov   - Maturing Your Cucumber Suites
Dmitry sharkov - Maturing Your Cucumber Suites
 

Recently uploaded

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 

Recently uploaded (20)

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 

Git-for-new-comers-and-absolute-beginners.pdf

  • 1.
  • 2. Git
  • 3. Explore nature in Canada. See more Home Contact Abbout 👩🏼‍💻
  • 4. Explore nature in Canada. See more Home Contact Explore nature in Canada. See more Home Contact www.mywebsite.com local 👩🏼‍💻 Abbout Abbout
  • 5. Explore nature in Canada. See more Home Contact Explore nature in Canada. See more Home Contact About www.mywebsite.com local 👩🏼‍💻 Visit Canada’s lakes and mountains. Abbout
  • 6. Explore nature in Canada. See more Home Contact Explore nature in Canada. See more Home Contact About www.mywebsite.com local 👩🏼‍💻 Visit Canada’s lakes and mountains. Abbout 🤦🏼‍ ♀️
  • 7. Git
  • 8.
  • 10. Hosted state of your website New state of your website with the local changes Explore nature in Canada. See more Home Contact Abbout Explore nature in Canada. See more Home Contact About Visit Canada’s lakes and mountains.
  • 11. Added front page Fixed buttons in navigation Added sub title Changed background image Fixed button CSS @max @sara @tim @max @sara 🙋🏽‍ ♂️ 🙋🏽‍ ♂️ 🙋🏼‍ ♀️ 🙋🏼‍ ♀️ 💁🏼‍ ♂️ 10.24AM 10.45AM 11.05AM 11.15AM 12.23AM
  • 12. Added front page Explore nature in Canada. See more Home Contact Abbout Explore nature in Canada. See more Home Contact Abbout Visit Canada’s lakes and mountains. Change background
  • 13. Added front page Explore nature in Canada. See more Home Contact Abbout Explore nature in Canada. See more Home Contact Abbout Visit Canada’s lakes and mountains. Change background
  • 14. Added front page Explore nature in Canada. See more Home Contact Abbout Explore nature in Canada. See more Home Contact Abbout Visit Canada’s lakes and mountains. Change background
  • 15. Fixed button typo Explore nature in Canada. See more Home Contact About Added front page Explore nature in Canada. See more Home Contact Abbout Explore nature in Canada. See more Home Contact Abbout Visit Canada’s lakes and mountains. Change background Explore nature in Canada. See more Home Contact About www.mywebsite.com
  • 16. Fixed button typo Explore nature in Canada. See more Home Contact About Added front page Explore nature in Canada. See more Home Contact Abbout Explore nature in Canada. See more Home Contact Abbout Visit Canada’s lakes and mountains. Change background Explore nature in Canada. See more Home Contact About www.mywebsite.com
  • 17. Remote Repository Local Repository <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> 👩🏽
  • 18. Remote Repository Local Repository Local Repository <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> 👩🏽 👱🏾‍ ♂️
  • 19. Remote Repository Local Repository Local Repository <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> 👩🏽 👱🏾‍ ♂️
  • 20. Remote Repository Local Repository Local Repository <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> <p>This is some more text!</p> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> 👩🏽 👱🏾‍ ♂️
  • 21. Remote Repository Local Repository Local Repository <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> <p>This is some more text!</p> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> 👩🏽 👱🏾‍ ♂️ <html> <body> <h1>My Website!</h1> <p>This is some more text!</p> </body> </html>
  • 22. Remote Repository Local Repository Local Repository <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> <html> <body> <h1>My Website!</h1> <p>This is some more text!</p> </body> </html> <html> <body> <h1>My Website!</h1> </body> </html> 👩🏽 👱🏾‍ ♂️ <html> <body> <h1>My Website!</h1> <p>This is some more text!</p> </body> </html> <html> <body> <h1>My Website!</h1> <p>This is some more text!</p> </body> </html> <html> <body> <h1>My Website!</h1> <p>This is some more text!</p> </body> </html>
  • 23. Working Area Staging Area Committed Files Local Repository
  • 24. commit Added front page Fixed buttons in navigation Added sub title Changed background image Fixed button CSS @max @sara @tim @max @sara 🙋🏽‍ ♂️ 🙋🏽‍ ♂️ 🙋🏼‍ ♀️ 🙋🏼‍ ♀️ 💁🏼‍ ♂️ commit commit commit commit
  • 25. Working Area Staging Area Committed Files Local Repository story1.txt story2.txt
  • 26.
  • 28. bash $ git init Initialized empty Git repository in /Users/lydiahallie/Desktop/myproject/.git/
  • 29. bash $ ls -a . .. .git
  • 30. bash $ touch story1.txt $ echo "This is a beautiful story" >> story1.txt
  • 31. bash $ git status On branch master No commits yet Untracked files: story1.txt nothing added to commit but untracked files present
  • 32. Working Area Staging Area Committed Files story1.txt bash $
  • 33. Working Area Staging Area Committed Files story1.txt bash $ git add story1.txt
  • 34. Working Area Staging Area Committed Files story1.txt bash $ git commit -m "Added first story"
  • 35. Added first story @me 🙋🏼‍ ♀️
  • 36.
  • 38. bash $ git log commit 67c833e3…ecb7df62f (HEAD -> master) Author: John Doe <john@doe> Date: Sun Jun 14 14:45:07 2020 -0700 Added first story
  • 39. bash $ git log —-oneline 67c833e (HEAD -> master) Added first story
  • 40.
  • 42.
  • 44. bash $ git remote add origin https://.../.../[name].git
  • 45. Working Area Staging Area Committed Files Local Repository
  • 46. Working Area Staging Area Committed Files Local Repository Remote Repository https://.../.../[name].git
  • 47. bash $ git remote -v origin https://.../.../[name].git (fetch) origin https://.../.../[name].git (push)
  • 48.
  • 50. Remote Repository Local Repository <html> <body> <h1>My Website!</h1> </body> </html> 👩🏽 <html> <body> <h1>My Website!</h1> </body> </html>
  • 51. bash $ git push origin master
  • 52. Added first story @me 🙋🏼‍ ♀️ Added second story @me 🙋🏼‍ ♀️ Added third story @me 🙋🏼‍ ♀️ Added fourth story @me 🙋🏼‍ ♀️ Added fifth story @me 🙋🏼‍ ♀️ remote local
  • 53.
  • 55. bash $ git clone <ssh link>
  • 56.
  • 57. bash $ git clone git@github.com:….…git Cloning into 'remote-repo'... remote: Enumerating objects: 59, done. remote: Counting objects: 100% (59/59), done. remote: Compressing objects: 100% (43/43), done. remote: Total 2948 (delta 28), reused 18 (delta 6) Receiving objects: 100% (2948/2948), 1.93 MiB | 2.53 MiB/s, done. Resolving deltas: 100% (1526/1526), done.
  • 58. bash $ cd remote-repo $ git log commit 67c833e3…ecb7df62f (HEAD -> origin/master) Author: John Doe <john@doe> Date: Sun Jun 14 14:45:07 2020 -0700 Added first story
  • 59.
  • 61. Added first story @me 🙋🏼‍ ♀️ Added second story @me 🙋🏼‍ ♀️ Added third story @me 🙋🏼‍ ♀️ Added fourth story @me 🙋🏼‍ ♀️ Added fifth story @me 🙋🏼‍ ♀️
  • 62. Added fourth story @me 🙋🏼‍ ♀️ Added fifth story @me 🙋🏼‍ ♀️ Fixed fourth story @friend 👨🏼‍💻 Added sixth story 👨🏼‍💻 Added seventh story @friend 👨🏼‍💻 @friend Added fifth story @me 🙋🏼‍ ♀️
  • 63. Added fourth story @me 🙋🏼‍ ♀️ Added fifth story @me 🙋🏼‍ ♀️ Fixed fourth story @friend 👨🏼‍💻 Added sixth story 👨🏼‍💻 Added seventh story @friend 👨🏼‍💻 @friend Added fifth story @me 🙋🏼‍ ♀️ Merged branch Dave @friend 👨🏼‍💻
  • 64. Added cool new feature 🙋🏼‍ ♀️ Updated tests 🙋🏼‍ ♀️
  • 65. Added cool new feature 🙋🏼‍ ♀️ Updated tests 🙋🏼‍ ♀️
  • 66. bash $ git checkout -b sarah Switched to a new branch 'sarah' $ git branch master * sarah
  • 67. Added first story @me 🙋🏼‍ ♀️ master sarah
  • 68. Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 master sarah
  • 69. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master
  • 70. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max
  • 71. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max
  • 72. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 Added third story @max 🧔🏻 max master
  • 73.
  • 75. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max Added third story @max 🧔🏻
  • 76. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max Added third story @max 🧔🏻 bash $ git checkout master
  • 77. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max Added third story @max 🧔🏻 bash $ git checkout master $ git merge max
  • 78. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max bash $ git checkout master $ git merge max Added third story @max 🧔🏻
  • 79. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max bash $ Added third story @max 🧔🏻 git merge sarah
  • 80. Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max bash $ Added third story @max 🧔🏻 git merge sarah sarah master Merge sarah into master @sarah 👩🏽‍💻
  • 81. Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max bash $ Added third story @max 🧔🏻 git merge sarah sarah master Merge sarah into master @sarah 👩🏽‍💻
  • 82.
  • 84. Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max Added third story @max 🧔🏻 sarah master Merge sarah into master @sarah 👩🏽‍💻
  • 85. sarah Started fourth story @sarah 👩🏽‍💻 master max Started fourth story @max 🧔🏻 ## Fourth Story This is Max’s version of the fourth story! ## Fourth Story This is Sarah’s version of the fourth story! fourth_story.md fourth_story.md Some extra stuff Sarah added
  • 86. sarah Started fourth story @sarah 👩🏽‍💻 master max Started fourth story @max 🧔🏻
  • 87. sarah Started fourth story @sarah 👩🏽‍💻 master max Started fourth story @max 🧔🏻
  • 88. sarah Started fourth story @sarah 👩🏽‍💻 master max Started fourth story @max 🧔🏻 ## Fourth Story ## Fourth Story This is Sarah’s version of the fourth story! fourth_story.md fourth_story.md This is Max’s version of the fourth story!
  • 89. ## Fourth Story <<<<<<<< HEAD This is Sarah’s version ======= >>>>>>> max fourth_story.md Some extra stuff Sarah added This is Max’s version of the fourth story!
  • 90. ## Fourth Story <<<<<<<< HEAD This is Sarah’s version ======= >>>>>>> max fourth_story.md This is Max’s version Some extra stuff Sarah added of the fourth story!
  • 91. sarah Started fourth story @sarah 👩🏽‍💻 master max Started fourth story @max 🧔🏻 bash $ git add fourth_story.txt $ git merge
  • 92. sarah Started fourth story @sarah 👩🏽‍💻 Started fourth story @max 🧔🏻 bash $ git add fourth_story.txt $ git merge Merge max into master @max 🧔🏻 master max
  • 93.
  • 95. 🧔🏻 Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max Added third story @max 🧔🏻 origin/master
  • 96. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max Added third story @max 🧔🏻 bash $ git push origin sarah origin/sarah origin/master
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 104. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max Added third story @max 🧔🏻 origin/sarah origin/master bash $ git fetch origin master
  • 105. Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max Added third story @max 🧔🏻 origin/sarah origin/master bash $ git merge origin/master
  • 106. bash $ git pull origin master Added first story @me 🙋🏼‍ ♀️ sarah Added second story @sarah 👩🏽‍💻 master max Added third story @max 🧔🏻 origin/sarah origin/master
  • 107.
  • 109. Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max bash $ Added third story @max 🧔🏻 git merge sarah sarah master Merge sarah into master @sarah 👩🏽‍💻
  • 110. Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max bash $ Added third story @max 🧔🏻 git rebase sarah sarah master
  • 111. Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max bash $ Added third story @max 🧔🏻 git rebase sarah sarah master
  • 112. bash $ 🧔🏻 Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max Added third story @max 🧔🏻 sarah master 89fej 7wtf78 jf79w
  • 113. bash $ 🧔🏻 git merge sarah Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max Added third story @max 🧔🏻 sarah master 89fej 7wtf78 jf79w Merge sarah into master @sarah 👩🏽‍💻 90f7d
  • 114. bash $ git rebase sarah Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max Added third story @max 🧔🏻 sarah master 89fej 7wtf78 jf79w
  • 115. bash $ git rebase sarah Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 max Added third story @max 🧔🏻 sarah master 89fej 7wtf78 890sf
  • 116.
  • 118. Added second story @sarah 👩🏽‍💻 bash $ sarah Changes to second story @sarah 👩🏽‍💻 Oops more changes to second story @sarah 👩🏽‍💻 More changes to second story @sarah 👩🏽‍💻 6a6f6 8ad5d aaba5 fb9f1
  • 119. Added second story @sarah 👩🏽‍💻 bash $ git rebase -i sarah Changes to second story @sarah 👩🏽‍💻 Oops more changes to second story @sarah 👩🏽‍💻 More changes to second story @sarah 👩🏽‍💻 HEAD~4 6a6f6 8ad5d aaba5 fb9f1
  • 120. bash $ git rebase -i HEAD~4 pick pick pick aaba5e7 Changes to second story 8ad5d7b Oops more changes to second story 6a6f68b More changes to second story pick fb9f191 Added second story # Rebase dc9ad3c..6a6f68b onto 6a6f68b (4 commands) # # Commands: # p, pick <commit> = use commit # r, reword <commit> = use commit, but edit the commit message # e, edit <commit> = use commit, but stop for amending # s, squash <commit> = use commit, but meld into previous commit # f, fixup <commit> = like "squash", but discard this commit's log message # x, exec <command> = run command (the rest of the line) using shell # b, break = stop here (continue rebase later with 'git rebase --continue') # d, drop <commit> = remove commit # l, label <label> = label current HEAD with a name # t, reset <label> = reset HEAD to a label # m, merge [-C <commit> | -c <commit>] <label> [# <oneline>] # . create a merge commit using the original merge commit's # . message (or the oneline, if no original merge commit was # . specified). Use -c <commit> to reword the commit message.
  • 121. bash $ git rebase -i HEAD~4 pick pick pick aaba5e7 Changes to second story 8ad5d7b Oops more changes to second story 6a6f68b More changes to second story pick fb9f191 Added second story # Rebase dc9ad3c..6a6f68b onto 6a6f68b (4 commands) # # Commands: # p, pick <commit> = use commit # r, reword <commit> = use commit, but edit the commit message # e, edit <commit> = use commit, but stop for amending # s, squash <commit> = use commit, but meld into previous commit # f, fixup <commit> = like "squash", but discard this commit's log message # x, exec <command> = run command (the rest of the line) using shell # b, break = stop here (continue rebase later with 'git rebase --continue') # d, drop <commit> = remove commit # l, label <label> = label current HEAD with a name # t, reset <label> = reset HEAD to a label # m, merge [-C <commit> | -c <commit>] <label> [# <oneline>] # . create a merge commit using the original merge commit's # . message (or the oneline, if no original merge commit was # . specified). Use -c <commit> to reword the commit message.
  • 122. bash $ git rebase -i HEAD~4 pick fb9f191 Added second story # Rebase dc9ad3c..6a6f68b onto 6a6f68b (4 commands) # # Commands: # p, pick <commit> = use commit # r, reword <commit> = use commit, but edit the commit message # e, edit <commit> = use commit, but stop for amending # s, squash <commit> = use commit, but meld into previous commit # f, fixup <commit> = like "squash", but discard this commit's log message # x, exec <command> = run command (the rest of the line) using shell # b, break = stop here (continue rebase later with 'git rebase --continue') # d, drop <commit> = remove commit # l, label <label> = label current HEAD with a name # t, reset <label> = reset HEAD to a label # m, merge [-C <commit> | -c <commit>] <label> [# <oneline>] # . create a merge commit using the original merge commit's # . message (or the oneline, if no original merge commit was # . specified). Use -c <commit> to reword the commit message. squash squash squash aaba5e7 Changes to second story 8ad5d7b Oops more changes to second story 6a6f68b More changes to second story
  • 123. Added second story @sarah 👩🏽‍💻 bash $ git rebase -i sarah Changes to second story @sarah 👩🏽‍💻 Oops more changes to second story @sarah 👩🏽‍💻 More changes to second story @sarah 👩🏽‍💻 HEAD~4 6a6f6 8ad5d aaba5 fb9f1
  • 124. Added second story @sarah 👩🏽‍💻 bash $ git rebase -i sarah 81h48 HEAD~4 Changes to second story Oops more changes to second story More changes to second story
  • 125.
  • 127. bash $ Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah 89fej jf79w 8ad5d aaba5 Changed first story @sarah 👩🏽‍💻 Changed second story @sarah 👩🏽‍💻
  • 128. bash $ Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah 89fej jf79w 8ad5d aaba5 Changed first story @sarah 👩🏽‍💻 Changed second story @sarah 👩🏽‍💻 git cherry-pick aaba5
  • 129. bash $ Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah 89fej jf79w 8ad5d aaba5 Changed first story @sarah 👩🏽‍💻 Changed second story @sarah 👩🏽‍💻 git cherry-pick aaba5 89hd8
  • 130. bash $ Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah 89fej jf79w 8ad5d aaba5 Changed first story @sarah 👩🏽‍💻 Changed second story @sarah 👩🏽‍💻 git cherry-pick aaba5 89hd8
  • 131. bash $ echo "This is my first story" >> first_story.txt
  • 132. Porcelain Commands git add git status git commit git stash … Plumbing Commands git hash-object git ls-files git rev-parse git ls-remote …
  • 133. bash $ git hash-object first_story.txt bea8d7fee8e7b11c2235ca623935e6ccccd8bac3
  • 134. bash $ git hash-object first_story.txt bea8d7fee8e7b11c2235ca623935e6ccccd8bac3
  • 135. bash $ git add first_story.txt $ git commit -m "First story" $ ls ./.git/objects 26 be a0 info pack
  • 136. bash $ git add first_story.txt $ git commit -m "First story" $ ls ./.git/objects 26 be a0 info pack $ ls ./.git/objects/be a8d7fee8e7b11c2235ca623935e6ccccd8bac3
  • 137. bash $ git add first_story.txt $ git commit -m "First story" $ ls ./.git/objects 26 be a0 info pack $ ls ./.git/objects/be a8d7fee8e7b11c2235ca623935e6ccccd8bac3 $ git cat-file -p bea8d7 "This is my first story"
  • 138. bash $ git cat-file -p 4cdf4 tree 2ea7de7ff3bd48cbb020b215b36feb67ee7f9a30 parent f4e830485cc852686cf115e75a79cbb41a0de713 author Lydia Hallie <e@mail.com> 1594547678 +0200 committer Lydia Hallie <e@mail.com> 1594547678 +0200 First story
  • 139. bash $ git cat-file -p 4cdf4 tree 2ea7de7ff3bd48cbb020b215b36feb67ee7f9a30 parent f4e830485cc852686cf115e75a79cbb41a0de713 author Lydia Hallie <e@mail.com> 1594547678 +0200 committer Lydia Hallie <e@mail.com> 1594547678 +0200 First story
  • 141. Added second story @sarah 👩🏽‍💻 Changes to second story @sarah 👩🏽‍💻 Added third story @sarah 👩🏽‍💻 8ad5d aaba5 fb9f1
  • 142. Added second story @sarah 👩🏽‍💻 Changes to second story @sarah 👩🏽‍💻 Added third story @sarah 👩🏽‍💻 8ad5d aaba5 fb9f1
  • 143. Added second story @sarah 👩🏽‍💻 Changes to second story @sarah 👩🏽‍💻 Added third story @sarah 👩🏽‍💻 8ad5d aaba5 fb9f1
  • 148.
  • 150. Added second story @sarah 👩🏽‍💻 bash $ sarah Changes to second story @sarah 👩🏽‍💻 Added third story @sarah 👩🏽‍💻 8ad5d aaba5 fb9f1
  • 151. Added second story @sarah 👩🏽‍💻 bash $ sarah Changes to second story @sarah 👩🏽‍💻 Added third story @sarah 👩🏽‍💻 8ad5d aaba5 fb9f1 git revert 8ad5d + third_story.md
  • 152. Added second story @sarah 👩🏽‍💻 bash $ sarah Changes to second story @sarah 👩🏽‍💻 Added third story @sarah 👩🏽‍💻 8ad5d aaba5 fb9f1 git revert 8ad5d Reverted “Added third story” @sarah 👩🏽‍💻 890hs - third_story.md + third_story.md
  • 153. Added second story @sarah 👩🏽‍💻 bash $ sarah Changes to second story @sarah 👩🏽‍💻 Added third story @sarah 👩🏽‍💻 8ad5d aaba5 fb9f1
  • 154. Added second story @sarah 👩🏽‍💻 bash $ sarah Changes to second story @sarah 👩🏽‍💻 Added third story @sarah 👩🏽‍💻 8ad5d aaba5 fb9f1 git reset —-soft HEAD~1
  • 155. Added second story @sarah 👩🏽‍💻 sarah Changes to second story @sarah 👩🏽‍💻 aaba5 fb9f1 bash $ git reset —-soft HEAD~1
  • 156. Added second story @sarah 👩🏽‍💻 bash $ sarah Changes to second story @sarah 👩🏽‍💻 aaba5 fb9f1 $ git status On branch sarah Changes to be committed: added: third_story.md git reset —-soft HEAD~1
  • 157. Added second story @sarah 👩🏽‍💻 bash $ sarah Changes to second story @sarah 👩🏽‍💻 Added third story @sarah 👩🏽‍💻 8ad5d aaba5 fb9f1 git reset —-hard HEAD~1
  • 158. Added second story @sarah 👩🏽‍💻 sarah Changes to second story @sarah 👩🏽‍💻 aaba5 fb9f1 bash $ git reset —-hard HEAD~1
  • 159. Added second story @sarah 👩🏽‍💻 bash $ sarah Changes to second story @sarah 👩🏽‍💻 aaba5 fb9f1 $ git status On branch sarah Nothing to commit git reset —-hard HEAD~1
  • 160.
  • 162. Working Area Staging Area Committed Files bash $ git stash Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah + third_story.md
  • 163. Working Area Staging Area Committed Files Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah Stash bash $ git stash + third_story.md
  • 164. Working Area Staging Area Committed Files + third_story.md Stash WIP on sarah: f4e8304 Added second story Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah bash $ git stash
  • 165. Working Area Staging Area Committed Files + third_story.md Stash WIP on sarah: f4e8304 Added second story Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah bash $ git stash pop
  • 166. Working Area Staging Area Committed Files + third_story.md Stash WIP on sarah: f4e8304 Added second story Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah bash $ git stash pop
  • 167. Working Area Staging Area Committed Files Stash WIP on sarah: f4e8304 Added second story Added first story @me 🙋🏼‍ ♀️ Added second story @sarah 👩🏽‍💻 sarah bash $ git stash pop + third_story.md
  • 168. + third_story.md Stash bash $ git stash Staging Area
  • 169. + third_story.md Stash bash $ git stash Staging Area
  • 171. Stash bash $ git stash + fourth_story.md Staging Area + third_story.md
  • 172. Stash bash $ Staging Area git stash + fourth_story.md + third_story.md + fifth_story.md
  • 173. Stash bash $ git stash + fifth_story.md Staging Area + fourth_story.md + third_story.md
  • 174. bash $ git stash list stash@{0}: WIP on sarah: f4e8304 Added second story stash@{1}: WIP on sarah: f4e8304 Added second story stash@{2}: WIP on sarah: f4e8304 Added second story
  • 175. bash $ git stash list stash@{0}: WIP on sarah: f4e8304 Added second story stash@{1}: WIP on sarah: f4e8304 Added second story stash@{2}: WIP on sarah: f4e8304 Added second story $ git stash show stash@{1} fourth_story.md | 1 + 1 file changed, 1 addition(+)
  • 176. bash $ git stash list stash@{0}: WIP on sarah: f4e8304 Added second story stash@{1}: WIP on sarah: f4e8304 Added second story stash@{2}: WIP on sarah: f4e8304 Added second story $ git stash show stash@{1} fourth_story.md | 1 + 1 file changed, 1 addition(+) $ git stash pop stash@{1} Dropped stash@{1} (2cfe…)