Slide 1

Slide 1 text

Why Java Devs Should Care About Git & GitHub at the San Francisco JUG by Matthew McCullough

Slide 2

Slide 2 text

@matthewmccull [email protected] github.com/training

Slide 3

Slide 3 text

Matthew McCullough @matthewmccull

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

Git

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

“Cool kids” version control system

Slide 10

Slide 10 text

Open Source

Slide 11

Slide 11 text

bash scripts C code

Slide 12

Slide 12 text

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

Git and Java

Slide 15

Slide 15 text

Git and the JVM

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

JGit

Slide 19

Slide 19 text

Git in pure Java

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Central Repo

Slide 24

Slide 24 text

Blessed Repo

Slide 25

Slide 25 text

Certified Repo Development Repo Continuous Integration Server

Slide 26

Slide 26 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 27

Slide 27 text

➡How to set up a Git repository

Slide 28

Slide 28 text

No daemon

Slide 29

Slide 29 text

No special repo area

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 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 33

Slide 33 text

➡How to commit, branch and tag

Slide 34

Slide 34 text

The three basics

Slide 35

Slide 35 text

➡How to commit

Slide 36

Slide 36 text

> git add

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

Local Branches Remote Branches Upstream Branches Working Copy commit

Slide 40

Slide 40 text

➡How to branch

Slide 41

Slide 41 text

> git branch

Slide 42

Slide 42 text

Local Branches Remote Branches Upstream Branches Working Copy

Slide 43

Slide 43 text

Local Branches Remote Branches Upstream Branches Working Copy

Slide 44

Slide 44 text

> git checkout Switched to branch 'mybranch'

Slide 45

Slide 45 text

Local Branches Remote Branches Upstream Branches Working Copy

Slide 46

Slide 46 text

Local Branches Remote Branches Upstream Branches Working Copy

Slide 47

Slide 47 text

➡How to tag

Slide 48

Slide 48 text

> git tag -a -m””

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 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 51

Slide 51 text

➡How Git implements a new commit-referencing syntax

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

9AB223D28B1AA46EF1780B22F304982E39872C34

This is a test

Slide 54

Slide 54 text

9AB223D28B1AA46EF1780B22F304982E39872C34

This is a test

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

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 61

Slide 61 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 62

Slide 62 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 63

Slide 63 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 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

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 69

Slide 69 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 70

Slide 70 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 71

Slide 71 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 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

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

Slide 75

Slide 75 text

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

Slide 76

Slide 76 text

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

Slide 77

Slide 77 text

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

Slide 78

Slide 78 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 79

Slide 79 text

No content

Slide 80

Slide 80 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 81

Slide 81 text

➡How to pull and push changes between repositories

Slide 82

Slide 82 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 83

Slide 83 text

Local Branches Remote Branches Upstream Branches Working Copy clone clone clone

Slide 84

Slide 84 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 85

Slide 85 text

Local Branches Remote Branches Upstream Branches Working Copy push push commit

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

Why Java Devs Should Care About Git & GitHub at the San Francisco JUG by Matthew McCullough

Slide 90

Slide 90 text

@matthewmccull [email protected] github.com/training