Slide 1

Slide 1 text

Introduction to Git & Gerrit at the London JUG by Matthew McCullough and Alex Blewitt

Slide 2

Slide 2 text

Matthew McCullough @matthewmccull

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Git

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

“Cool kids” version control system

Slide 11

Slide 11 text

Open Source

Slide 12

Slide 12 text

bash scripts ☛ C code

Slide 13

Slide 13 text

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git. -Linus Torvalds “ ”

Slide 16

Slide 16 text

➡How to commit, branch and tag ➡How Git implements a new commit-referencing syntax ➡How to pull and push changes between repositories ➡How to set up a Git repository

Slide 17

Slide 17 text

➡How to set up a Git repository

Slide 18

Slide 18 text

No daemon

Slide 19

Slide 19 text

No special repo area

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

> cd myproj > git init Initialized empty Git repository in /stuff/myproj/.git/

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

➡How to commit, branch and tag ➡How Git implements a new commit-referencing syntax ➡How to pull and push changes between repositories ➡How to set up a Git repository

Slide 25

Slide 25 text

➡How to commit, branch and tag

Slide 26

Slide 26 text

The three basics

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

➡How to commit

Slide 29

Slide 29 text

> git add

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

> git status # On branch master # Initial commit # Changes to be committed: # (use "git rm --cached ..." to unstage) # new file: myfile.txt

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

> git commit -m”” [master (root-commit) 498cc44] My first commit 1 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 myfile.txt

Slide 34

Slide 34 text

Local Branches Remote Branches Upstream Branches Working Copy commit

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

➡How to branch

Slide 37

Slide 37 text

> git branch

Slide 38

Slide 38 text

Local Branches Remote Branches Upstream Branches Working Copy

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

> git checkout Switched to branch 'mybranch'

Slide 41

Slide 41 text

Local Branches Remote Branches Upstream Branches Working Copy

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

➡How to tag

Slide 44

Slide 44 text

> git tag -a -m””

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

➡How to commit, branch and tag ➡How Git implements a new commit-referencing syntax ➡How to pull and push changes between repositories ➡How to set up a Git repository

Slide 48

Slide 48 text

➡How Git implements a new commit-referencing syntax

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

9AB223D28B1AA46EF1780B22F304982E39872C34

This is a test

Slide 51

Slide 51 text

tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob: 8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162

Slide 52

Slide 52 text

tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob: 8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162

Slide 53

Slide 53 text

tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob: 8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162

Slide 54

Slide 54 text

tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob: 8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162

Slide 55

Slide 55 text

tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob: 8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162

Slide 56

Slide 56 text

tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob: 8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162

Slide 57

Slide 57 text

tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob: 8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162

Slide 58

Slide 58 text

tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob: 8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162

Slide 59

Slide 59 text

tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob: 8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162

Slide 60

Slide 60 text

v1 v2 v3 commit tree: 9a87b parent: nil author: Fird committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7

Slide 61

Slide 61 text

v1 v2 v3 commit tree: 9a87b parent: nil author: Fird committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7

Slide 62

Slide 62 text

v1 v2 v3 commit tree: 9a87b parent: nil author: Fird committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7

Slide 63

Slide 63 text

v1 v2 v3 commit tree: 9a87b parent: nil author: Fird committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7

Slide 64

Slide 64 text

v1 v2 v3 commit tree: 9a87b parent: nil author: Fird committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7

Slide 65

Slide 65 text

v1 v2 v3 commit tree: 9a87b parent: nil author: Fird committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7

Slide 66

Slide 66 text

v1 v2 v3 commit tree: 9a87b parent: nil author: Fird committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7

Slide 67

Slide 67 text

v1 v2 v3 commit tree: 9a87b parent: nil author: Fird committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7

Slide 68

Slide 68 text

RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit 8c2d1 commit 1bdcd commit 2daa1

Slide 69

Slide 69 text

RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit 8c2d1 commit 1bdcd commit 2daa1

Slide 70

Slide 70 text

RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit 8c2d1 commit 1bdcd commit 2daa1

Slide 71

Slide 71 text

RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit 8c2d1 commit 1bdcd commit 2daa1

Slide 72

Slide 72 text

RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit 8c2d1 commit 1bdcd commit 2daa1

Slide 73

Slide 73 text

RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit 8c2d1 commit 1bdcd commit 2daa1

Slide 74

Slide 74 text

> git log commit 0fc27c73dea82a0576c6cf262fb517d24e75a223 Author: Matthew McCullough Date: Mon Oct 24 10:42:20 2013 +0300 Performance enhancement of calc engine commit 7d946e814233814b1780ed1035da271cbb37206d Author: Matthew McCullough Date: Mon Oct 24 12:59:41 2013 +0300 Translation to Esperanto

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

➡How to commit, branch and tag ➡How Git implements a new commit-referencing syntax ➡How to pull and push changes between repositories ➡How to set up a Git repository

Slide 78

Slide 78 text

➡How to pull and push changes between repositories

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

> git clone http://this.com/myproj.git Cloning into myproj... remote: Counting objects: 3871, done. remote: Compressing objects: 100% (73/73), done. remote: Total 3871 (delta 51), reused 3853 (delta 36) Receiving objects: 100% (3871/3871), 297.88 KiB | 35 KiB/s, done. Resolving deltas: 100% (51/51), done. > cd myproj

Slide 81

Slide 81 text

Local Branches Remote Branches Upstream Branches Working Copy clone clone clone

Slide 82

Slide 82 text

No content

Slide 83

Slide 83 text

> git push Counting objects: 16, done. Delta compression using up to 2 threads. Compressing objects: 100% (10/10), done. Writing objects: 100% (15/15), 1.37 KiB, done. Total 15 (delta 5), reused 0 (delta 0) To http://this.com/myproj.git 6128b94..7607971 master -> master

Slide 84

Slide 84 text

Local Branches Remote Branches Upstream Branches Working Copy push push commit

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

> git pull Updating 474f43d..7607971 Fast-forward sample5.htm | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 sample5.htm

Slide 87

Slide 87 text

Local Branches Remote Branches Upstream Branches Working Copy pull pull pull

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

Next: Alex Blewitt on Gerrit

Slide 91

Slide 91 text

No content

Slide 92

Slide 92 text

Introduction to Git & Gerrit at the London JUG by Matthew McCullough and Alex Blewitt