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

Intro to Git and Gerrit at the London JUG

Apr 12, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Intro to Git and Gerrit at the London JUG

Introduction to Git & Gerrit

at the London JUG

by Matthew McCullough and Alex Blewitt

Page 2: Intro to Git and Gerrit at the London JUG

Matthew McCullough

@matthewmccull

Page 3: Intro to Git and Gerrit at the London JUG
Page 4: Intro to Git and Gerrit at the London JUG
Page 5: Intro to Git and Gerrit at the London JUG
Page 6: Intro to Git and Gerrit at the London JUG
Page 7: Intro to Git and Gerrit at the London JUG
Page 8: Intro to Git and Gerrit at the London JUG

Git

Page 9: Intro to Git and Gerrit at the London JUG
Page 10: Intro to Git and Gerrit at the London JUG

“Cool kids” version control system

Page 11: Intro to Git and Gerrit at the London JUG

Open Source

Page 12: Intro to Git and Gerrit at the London JUG

bash scripts ☛ C code

Page 13: Intro to Git and Gerrit at the London JUG

Page 14: Intro to Git and Gerrit at the London JUG
Page 16: Intro to Git and Gerrit at the London JUG

➡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

Page 17: Intro to Git and Gerrit at the London JUG

➡How to set up a Git repository

Page 18: Intro to Git and Gerrit at the London JUG

No daemon

Page 19: Intro to Git and Gerrit at the London JUG

No special repo area

Page 20: Intro to Git and Gerrit at the London JUG
Page 21: Intro to Git and Gerrit at the London JUG

> cd myproj> git initInitialized empty Git repository in /stuff/myproj/.git/

Page 22: Intro to Git and Gerrit at the London JUG
Page 23: Intro to Git and Gerrit at the London JUG
Page 24: Intro to Git and Gerrit at the London JUG

➡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

Page 25: Intro to Git and Gerrit at the London JUG

➡How to commit, branch and tag

Page 26: Intro to Git and Gerrit at the London JUG

The three basics

Page 27: Intro to Git and Gerrit at the London JUG
Page 28: Intro to Git and Gerrit at the London JUG

➡How to commit

Page 29: Intro to Git and Gerrit at the London JUG

> git add <FILENAME>

Page 30: Intro to Git and Gerrit at the London JUG
Page 31: Intro to Git and Gerrit at the London JUG

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

Page 32: Intro to Git and Gerrit at the London JUG
Page 33: Intro to Git and Gerrit at the London JUG

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

Page 34: Intro to Git and Gerrit at the London JUG

Local Branches

Remote Branches

Upstream Branches

Working Copy

commit

Page 35: Intro to Git and Gerrit at the London JUG
Page 36: Intro to Git and Gerrit at the London JUG

➡How to branch

Page 37: Intro to Git and Gerrit at the London JUG

> git branch <BRANCHNAME>

Page 38: Intro to Git and Gerrit at the London JUG

Local Branches

Remote Branches

Upstream Branches

Working Copy

Page 39: Intro to Git and Gerrit at the London JUG
Page 40: Intro to Git and Gerrit at the London JUG

> git checkout <BRANCHNAME>Switched to branch 'mybranch'

Page 41: Intro to Git and Gerrit at the London JUG

Local Branches

Remote Branches

Upstream Branches

Working Copy

Page 42: Intro to Git and Gerrit at the London JUG
Page 43: Intro to Git and Gerrit at the London JUG

➡How to tag

Page 44: Intro to Git and Gerrit at the London JUG

> git tag -a <TAGNAME> -m”<MESSAGE>”

Page 45: Intro to Git and Gerrit at the London JUG
Page 46: Intro to Git and Gerrit at the London JUG
Page 47: Intro to Git and Gerrit at the London JUG

➡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

Page 48: Intro to Git and Gerrit at the London JUG

➡How Git implements a new commit-referencing syntax

Page 49: Intro to Git and Gerrit at the London JUG
Page 50: Intro to Git and Gerrit at the London JUG

9AB223D28B1AA46EF1780B22F304982E39872C34

<html><body>

<p>This is a test</p><img src="http://ai.com/icon.gif">

</body></html>

Page 51: Intro to Git and Gerrit at the London JUG

treetree: 7e8b1 webblob: 9ab16 index.html

a10b3 treeblob: 8d162 logo.jpgblob: 51d22 draw.js

7e8b1commit

tree: a10b3parent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the web content.

c67db

blob<html>

<body></body></html>

9ab16

blob//Some more javascriptvar renderSize

51d22

blob7D 8D B3 7F BD 12 9F E97B 78 9D 3F 5C A6 72 CB

8d162

Page 52: Intro to Git and Gerrit at the London JUG

treetree: 7e8b1 webblob: 9ab16 index.html

a10b3 treeblob: 8d162 logo.jpgblob: 51d22 draw.js

7e8b1commit

tree: a10b3parent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the web content.

c67db

blob<html>

<body></body></html>

9ab16

blob//Some more javascriptvar renderSize

51d22

blob7D 8D B3 7F BD 12 9F E97B 78 9D 3F 5C A6 72 CB

8d162

Page 53: Intro to Git and Gerrit at the London JUG

treetree: 7e8b1 webblob: 9ab16 index.html

a10b3 treeblob: 8d162 logo.jpgblob: 51d22 draw.js

7e8b1commit

tree: a10b3parent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the web content.

c67db

blob<html>

<body></body></html>

9ab16

blob//Some more javascriptvar renderSize

51d22

blob7D 8D B3 7F BD 12 9F E97B 78 9D 3F 5C A6 72 CB

8d162

Page 54: Intro to Git and Gerrit at the London JUG

treetree: 7e8b1 webblob: 9ab16 index.html

a10b3 treeblob: 8d162 logo.jpgblob: 51d22 draw.js

7e8b1commit

tree: a10b3parent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the web content.

c67db

blob<html>

<body></body></html>

9ab16

blob//Some more javascriptvar renderSize

51d22

blob7D 8D B3 7F BD 12 9F E97B 78 9D 3F 5C A6 72 CB

8d162

Page 55: Intro to Git and Gerrit at the London JUG

treetree: 7e8b1 webblob: 9ab16 index.html

a10b3 treeblob: 8d162 logo.jpgblob: 51d22 draw.js

7e8b1commit

tree: a10b3parent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the web content.

c67db

blob<html>

<body></body></html>

9ab16

blob//Some more javascriptvar renderSize

51d22

blob7D 8D B3 7F BD 12 9F E97B 78 9D 3F 5C A6 72 CB

8d162

Page 56: Intro to Git and Gerrit at the London JUG

treetree: 7e8b1 webblob: 9ab16 index.html

a10b3 treeblob: 8d162 logo.jpgblob: 51d22 draw.js

7e8b1commit

tree: a10b3parent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the web content.

c67db

blob<html>

<body></body></html>

9ab16

blob//Some more javascriptvar renderSize

51d22

blob7D 8D B3 7F BD 12 9F E97B 78 9D 3F 5C A6 72 CB

8d162

Page 57: Intro to Git and Gerrit at the London JUG

treetree: 7e8b1 webblob: 9ab16 index.html

a10b3 treeblob: 8d162 logo.jpgblob: 51d22 draw.js

7e8b1commit

tree: a10b3parent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the web content.

c67db

blob<html>

<body></body></html>

9ab16

blob//Some more javascriptvar renderSize

51d22

blob7D 8D B3 7F BD 12 9F E97B 78 9D 3F 5C A6 72 CB

8d162

Page 58: Intro to Git and Gerrit at the London JUG

treetree: 7e8b1 webblob: 9ab16 index.html

a10b3 treeblob: 8d162 logo.jpgblob: 51d22 draw.js

7e8b1commit

tree: a10b3parent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the web content.

c67db

blob<html>

<body></body></html>

9ab16

blob//Some more javascriptvar renderSize

51d22

blob7D 8D B3 7F BD 12 9F E97B 78 9D 3F 5C A6 72 CB

8d162

Page 59: Intro to Git and Gerrit at the London JUG

treetree: 7e8b1 webblob: 9ab16 index.html

a10b3 treeblob: 8d162 logo.jpgblob: 51d22 draw.js

7e8b1commit

tree: a10b3parent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the web content.

c67db

blob<html>

<body></body></html>

9ab16

blob//Some more javascriptvar renderSize

51d22

blob7D 8D B3 7F BD 12 9F E97B 78 9D 3F 5C A6 72 CB

8d162

Page 60: Intro to Git and Gerrit at the London JUG

v1 v2 v3

committree: 9a87bparent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the Javascript renderingengine.

c67db

committree: b22c1parent: c67dbauthor: Timcommitter: Firdmessage:

Minor update to HTML

9bd21

committree: b22c1parent: 9bd21author: Johnnycommitter: Joemessage:

New language transations

1c2d7

Page 61: Intro to Git and Gerrit at the London JUG

v1 v2 v3

committree: 9a87bparent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the Javascript renderingengine.

c67db

committree: b22c1parent: c67dbauthor: Timcommitter: Firdmessage:

Minor update to HTML

9bd21

committree: b22c1parent: 9bd21author: Johnnycommitter: Joemessage:

New language transations

1c2d7

Page 62: Intro to Git and Gerrit at the London JUG

v1 v2 v3

committree: 9a87bparent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the Javascript renderingengine.

c67db

committree: b22c1parent: c67dbauthor: Timcommitter: Firdmessage:

Minor update to HTML

9bd21

committree: b22c1parent: 9bd21author: Johnnycommitter: Joemessage:

New language transations

1c2d7

Page 63: Intro to Git and Gerrit at the London JUG

v1 v2 v3

committree: 9a87bparent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the Javascript renderingengine.

c67db

committree: b22c1parent: c67dbauthor: Timcommitter: Firdmessage:

Minor update to HTML

9bd21

committree: b22c1parent: 9bd21author: Johnnycommitter: Joemessage:

New language transations

1c2d7

Page 64: Intro to Git and Gerrit at the London JUG

v1 v2 v3

committree: 9a87bparent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the Javascript renderingengine.

c67db

committree: b22c1parent: c67dbauthor: Timcommitter: Firdmessage:

Minor update to HTML

9bd21

committree: b22c1parent: 9bd21author: Johnnycommitter: Joemessage:

New language transations

1c2d7

Page 65: Intro to Git and Gerrit at the London JUG

v1 v2 v3

committree: 9a87bparent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the Javascript renderingengine.

c67db

committree: b22c1parent: c67dbauthor: Timcommitter: Firdmessage:

Minor update to HTML

9bd21

committree: b22c1parent: 9bd21author: Johnnycommitter: Joemessage:

New language transations

1c2d7

Page 66: Intro to Git and Gerrit at the London JUG

v1 v2 v3

committree: 9a87bparent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the Javascript renderingengine.

c67db

committree: b22c1parent: c67dbauthor: Timcommitter: Firdmessage:

Minor update to HTML

9bd21

committree: b22c1parent: 9bd21author: Johnnycommitter: Joemessage:

New language transations

1c2d7

Page 67: Intro to Git and Gerrit at the London JUG

v1 v2 v3

committree: 9a87bparent: nilauthor: Firdcommitter: Matthewmessage:

Major refactoringof the Javascript renderingengine.

c67db

committree: b22c1parent: c67dbauthor: Timcommitter: Firdmessage:

Minor update to HTML

9bd21

committree: b22c1parent: 9bd21author: Johnnycommitter: Joemessage:

New language transations

1c2d7

Page 68: Intro to Git and Gerrit at the London JUG

RELEASE_1.0 HEAD

bug979branch

commitc67db

commit9bd21

commit1c2d7

commit8c2d1

commit1bdcd

commit2daa1

Page 69: Intro to Git and Gerrit at the London JUG

RELEASE_1.0 HEAD

bug979branch

commitc67db

commit9bd21

commit1c2d7

commit8c2d1

commit1bdcd

commit2daa1

Page 70: Intro to Git and Gerrit at the London JUG

RELEASE_1.0 HEAD

bug979branch

commitc67db

commit9bd21

commit1c2d7

commit8c2d1

commit1bdcd

commit2daa1

Page 71: Intro to Git and Gerrit at the London JUG

RELEASE_1.0 HEAD

bug979branch

commitc67db

commit9bd21

commit1c2d7

commit8c2d1

commit1bdcd

commit2daa1

Page 72: Intro to Git and Gerrit at the London JUG

RELEASE_1.0 HEAD

bug979branch

commitc67db

commit9bd21

commit1c2d7

commit8c2d1

commit1bdcd

commit2daa1

Page 73: Intro to Git and Gerrit at the London JUG

RELEASE_1.0 HEAD

bug979branch

commitc67db

commit9bd21

commit1c2d7

commit8c2d1

commit1bdcd

commit2daa1

Page 74: Intro to Git and Gerrit at the London JUG

> git logcommit 0fc27c73dea82a0576c6cf262fb517d24e75a223Author: Matthew McCullough <[email protected]>Date: Mon Oct 24 10:42:20 2013 +0300

Performance enhancement of calc engine

commit 7d946e814233814b1780ed1035da271cbb37206dAuthor: Matthew McCullough <[email protected]>Date: Mon Oct 24 12:59:41 2013 +0300

Translation to Esperanto

Page 75: Intro to Git and Gerrit at the London JUG
Page 76: Intro to Git and Gerrit at the London JUG
Page 77: Intro to Git and Gerrit at the London JUG

➡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

Page 78: Intro to Git and Gerrit at the London JUG

➡How to pull and push changes between repositories

Page 79: Intro to Git and Gerrit at the London JUG
Page 80: Intro to Git and Gerrit at the London JUG

> git clone http://this.com/myproj.gitCloning 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

Page 81: Intro to Git and Gerrit at the London JUG

Local Branches

Remote Branches

Upstream Branches

Working Copy

clone clone clone

Page 82: Intro to Git and Gerrit at the London JUG
Page 83: Intro to Git and Gerrit at the London JUG

> git pushCounting 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

Page 84: Intro to Git and Gerrit at the London JUG

Local Branches

Remote Branches

Upstream Branches

Working Copy

pushpush

commit

Page 85: Intro to Git and Gerrit at the London JUG
Page 86: Intro to Git and Gerrit at the London JUG

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

Page 87: Intro to Git and Gerrit at the London JUG

Local Branches

Remote Branches

Upstream Branches

Working Copy

pull pull pull

Page 88: Intro to Git and Gerrit at the London JUG
Page 89: Intro to Git and Gerrit at the London JUG
Page 90: Intro to Git and Gerrit at the London JUG

Next: Alex Blewitt on Gerrit

Page 91: Intro to Git and Gerrit at the London JUG
Page 92: Intro to Git and Gerrit at the London JUG

Introduction to Git & Gerrit

at the London JUG

by Matthew McCullough and Alex Blewitt