Slide 1

Slide 1 text

1

Slide 2

Slide 2 text

2 . 1

Slide 3

Slide 3 text

2 . 2

Slide 4

Slide 4 text

2 . 3

Slide 5

Slide 5 text

3

Slide 6

Slide 6 text

4 . 1

Slide 7

Slide 7 text

4 . 2

Slide 8

Slide 8 text

4 . 3

Slide 9

Slide 9 text

git checkout -- /path/to/file 4 . 4

Slide 10

Slide 10 text

4 . 5

Slide 11

Slide 11 text

4 . 6

Slide 12

Slide 12 text

PULL FETCH MERGE git pull --rebase 4 . 7

Slide 13

Slide 13 text

4 . 8

Slide 14

Slide 14 text

git pull --rebase=preserve pull.rebase=preserve 4 . 9

Slide 15

Slide 15 text

4 . 10

Slide 16

Slide 16 text

5 . 1

Slide 17

Slide 17 text

git config --global help.autocorrect 1 git lol WARNING: You called a Git command named 'lol', which does not exist. Continuing under the assumption that you meant 'log' in 0.1 seconds automatically... commit 2feb149c8e76d12848f7535a8eb4d51b1c225776 Author: William Durand Date: Mon Nov 16 14:54:53 2015 +0100 add badges ... 5 . 2

Slide 18

Slide 18 text

git co commit config 5 . 3

Slide 19

Slide 19 text

GIT ARCHIVE git archive --format zip -o snapshot.zip HEAD git archive --format tar --prefix myapp/ | (cd /tmp && tar xf -) 5 . 4

Slide 20

Slide 20 text

git config --global rerere.enabled true git merge master Auto-merging index.html CONFLICT (content): Merge conflict in index.html Recorded preimage for 'index.html' Automatic merge failed; fix conflicts and then commit the result. git commit --no-edit Recorded resolution for 'index.html' [old-branch abcd123] Merge branch 'master' into old-branch git merge master Auto-merging index.html CONFLICT (content): Merge conflict in index.html Resolved 'index.html' using previous resolution. 5 . 5

Slide 21

Slide 21 text

GIT BISECT git bisect start git bisect good abcd123 git bisect bad [badd123] # The script should end with a non-zero return status when it fails git bisect run mvn clean test 5 . 6

Slide 22

Slide 22 text

6 . 1

Slide 23

Slide 23 text

git stash pop git stash -u 'current state' git stash apply 6 . 2

Slide 24

Slide 24 text

git rebase -i HEAD~ pick d1ed4e4 Fix typo pick b49cb42 Update for lavajug pick e35510f Add new images # Rebase 5f167bb..e35510f onto 5f167bb (3 command(s)) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove a line here THAT COMMIT WILL BE LOST. # # However, if you remove everything, the rebase will be aborted. # # Note that empty commits are commented out 6 . 3

Slide 25

Slide 25 text

git pull --rebase origin master 6 . 4

Slide 26

Slide 26 text

git add -p diff --git a/test.js b/test.js index 60ac996..2a57310 100644 --- a/test.js +++ b/test.js @@ -1,6 +1,5 @@ (function () { - var i, j; + var i = 0, j; - i = 0; - j = i; + j = 1; })(); Stage this hunk [y,n,q,a,d,/,s,e,?]? s Split into 2 hunks. @@ -1,3 +1,3 @@ (function () { - var i, j; + var i = 0, j; Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? 6 . 5

Slide 27

Slide 27 text

git commit --amend git commit --amend -m 'Fix undefined variable j Fix #123' 6 . 6

Slide 28

Slide 28 text

merge cherry-pick rebase git checkout - Switched to branch 'master' git checkout - Switched to branch 'feat-undefined-variable' 6 . 7

Slide 29

Slide 29 text

git branch --no-merged develop feat-another-feature feat-my-feature fix-undefined-variable git branch --merged * master 6 . 8

Slide 30

Slide 30 text

7 . 1

Slide 31

Slide 31 text

git format-patch master --stdout > fix-undefined-variable.patch From: William Durand Date: Thu, 13 Nov 2015 10:22:17 +0100 Subject: [PATCH] Fix undefined variable --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index 760e4eb..60ac996 100644 --- a/test.js +++ b/test.js @@ -1,5 +1,5 @@ (function () { - var i; + var i, j; i = 0; j = i; -- 2.1.2 7 . 2

Slide 32

Slide 32 text

git apply --stat fix-undefined-variable.patch test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 7 . 3

Slide 33

Slide 33 text

git apply --check fix-undefined-variable.patch 7 . 4

Slide 34

Slide 34 text

patch -p1 git am --signoff < fix-undefined-variable.patch Applying: Fix undefined variable commit 4c20f8d517b99638f5379f3f0894ad076d2b6a5b Author: William Durand Date: Thu Nov 13 10:22:17 2015 +0100 Fix undefined variable Signed-off-by: William Durand 7 . 5

Slide 35

Slide 35 text

8 . 1

Slide 36

Slide 36 text

8 . 2

Slide 37

Slide 37 text

8 . 3

Slide 38

Slide 38 text

8 . 4

Slide 39

Slide 39 text

8 . 5

Slide 40

Slide 40 text

8 . 6

Slide 41

Slide 41 text

8 . 7

Slide 42

Slide 42 text

8 . 8

Slide 43

Slide 43 text

8 . 9

Slide 44

Slide 44 text

8 . 10

Slide 45

Slide 45 text

8 . 11

Slide 46

Slide 46 text

8 . 12

Slide 47

Slide 47 text

8 . 13

Slide 48

Slide 48 text

8 . 14

Slide 49

Slide 49 text

T 8 . 15

Slide 50

Slide 50 text

.PATCH https://github.com/your/repo/commit/e0af340837978f80d8cd144a4475.patch 8 . 16

Slide 51

Slide 51 text

curl https://github.com/your/repo/commit/.patch |git am Applying: Fix undefined variable 8 . 17

Slide 52

Slide 52 text

.DIFF https://github.com/your/repo/commit/e0af340837978f80d8cd144a4475.diff 8 . 18

Slide 53

Slide 53 text

HUB alias git=hub 9 . 1

Slide 54

Slide 54 text

git clone random/repo # git clone git://github.com/random/repo.git git clone repo # git clone git://github.com/YOUR/repo.git 9 . 2

Slide 55

Slide 55 text

git browse # open https://github.com/random/repo git browse -- issues # open https://github.com/random/repo/issues 9 . 3

Slide 56

Slide 56 text

git fetch ubermuda # git remote add ubermuda git://github.com/ubermuda/repo.git # git fetch ubermuda 9 . 4

Slide 57

Slide 57 text

git checkout https://github.com/your/repo/pull/123 # git remote add contributor git://github.com/contributor/repo.git # git fetch contributor # git checkout -b contributor-branch contributor/branch 9 . 5

Slide 58

Slide 58 text

git am -3 https://github.com/your/repo/pull/123 9 . 6

Slide 59

Slide 59 text

git cherry-pick https://github.com/random/repo/commit/SHA # git remote random git://github.com/random/repo.git # git fetch random # git cherry-pick SHA 9 . 7

Slide 60

Slide 60 text

git fork, git pull-request, merge, ci-status, etc. 9 . 8

Slide 61

Slide 61 text

10 . 1

Slide 62

Slide 62 text

10 . 2

Slide 63

Slide 63 text

10 . 3

Slide 64

Slide 64 text

10 . 4

Slide 65

Slide 65 text

≈ 10 . 5

Slide 66

Slide 66 text

11 . 1

Slide 67

Slide 67 text

11 . 2

Slide 68

Slide 68 text

11 . 3

Slide 69

Slide 69 text

11 . 3

Slide 70

Slide 70 text

11 . 4

Slide 71

Slide 71 text

11 . 5

Slide 72

Slide 72 text

11 . 6

Slide 73

Slide 73 text

12 . 1

Slide 74

Slide 74 text

12 . 2

Slide 75

Slide 75 text

12 . 3

Slide 76

Slide 76 text

13 . 1

Slide 77

Slide 77 text

13 . 2

Slide 78

Slide 78 text

13 . 3

Slide 79

Slide 79 text

git checkout -b feature-branch 13 . 4

Slide 80

Slide 80 text

13 . 5

Slide 81

Slide 81 text

13 . 6

Slide 82

Slide 82 text

13 . 6

Slide 83

Slide 83 text

CONTRIBUTING 13 . 7

Slide 84

Slide 84 text

Capitalized, short (50 chars or less) summary More detailed explanatory text, if necessary. Wrap it to about 72 characters or so. In some contexts, the first line is treated as the subject of an email and the rest of the text as the body. The blank line separating the summary from the body is critical (unless you omit the body entirely); tools like rebase can get confused if you run the two together. Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug." This convention matches up with commit messages generated by commands like git merge and git revert. Further paragraphs come after blank lines. 13 . 8

Slide 85

Slide 85 text

≤ 13 . 9

Slide 86

Slide 86 text

≤ Fix #123 13 . 10

Slide 87

Slide 87 text

13 . 11

Slide 88

Slide 88 text

git rebase -i HEAD~2 pick 5335450 add test pick 4c20f8d Fix undefined variable # Rebase 35124cb..4c20f8d onto 35124cb # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove a line here THAT COMMIT WILL BE LOST. # # However, if you remove everything, the rebase will be aborted. # # Note that empty commits are commented out 13 . 12

Slide 89

Slide 89 text

13 . 13

Slide 90

Slide 90 text

13 . 14

Slide 91

Slide 91 text

14 . 1

Slide 92

Slide 92 text

14 . 2

Slide 93

Slide 93 text

14 . 3

Slide 94

Slide 94 text

14 . 4

Slide 95

Slide 95 text

14 . 5

Slide 96

Slide 96 text

15 . 1

Slide 97

Slide 97 text

15 . 2

Slide 98

Slide 98 text

15 . 3

Slide 99

Slide 99 text

15 . 4

Slide 100

Slide 100 text

15 . 5

Slide 101

Slide 101 text

README 15 . 6

Slide 102

Slide 102 text

project-x ========= project-x is a better way to achieve this and that, by leveraging the new API, bla bla bla. ## Usage ... ## Installation ... ## Requirements ... ## Contributing See CONTRIBUTING file. 15 . 7

Slide 103

Slide 103 text

## Running the Tests ... ## Credits ... ## Contributor Code of Conduct Please note that this project is released with a [Contributor Code of Conduct](http://contributor-covenant.org/). By participating in this project you agree to abide by its terms. See CODE_OF_CONDUCT file. ## License project-x is released under the MIT License. See the bundled LICENSE file for details. 15 . 8

Slide 104

Slide 104 text

CONTRIBUTING 15 . 9

Slide 105

Slide 105 text

15 . 10

Slide 106

Slide 106 text

CODE_OF_CONDUCT 15 . 11

Slide 107

Slide 107 text

15 . 12

Slide 108

Slide 108 text

15 . 13

Slide 109

Slide 109 text

15 . 14

Slide 110

Slide 110 text

15 . 15

Slide 111

Slide 111 text

15 . 16

Slide 112

Slide 112 text

15 . 17

Slide 113

Slide 113 text

15 . 18

Slide 114

Slide 114 text

15 . 19

Slide 115

Slide 115 text

15 . 20

Slide 116

Slide 116 text

15 . 21

Slide 117

Slide 117 text

16 . 1

Slide 118

Slide 118 text

MAJOR.MINOR.PATCH 16 . 2

Slide 119

Slide 119 text

16 . 3

Slide 120

Slide 120 text

git commit -m "Prepare X.Y.Z release" git tag vX.Y.Z gem build Z++ git commit -m "Bump version to X.Y.Z+1-dev" git push origin master --tags gem push 16 . 4

Slide 121

Slide 121 text

17 . 1

Slide 122

Slide 122 text

17 . 2

Slide 123

Slide 123 text

17 . 3

Slide 124

Slide 124 text

17 . 4

Slide 125

Slide 125 text

17 . 5

Slide 126

Slide 126 text

17 . 6

Slide 127

Slide 127 text

17 . 7

Slide 128

Slide 128 text

17 . 8

Slide 129

Slide 129 text

17 . 9

Slide 130

Slide 130 text

17 . 10

Slide 131

Slide 131 text

17 . 11

Slide 132

Slide 132 text

17 . 12

Slide 133

Slide 133 text

17 . 13

Slide 134

Slide 134 text

17 . 14

Slide 135

Slide 135 text

17 . 15

Slide 136

Slide 136 text

17 . 16

Slide 137

Slide 137 text

18 . 1

Slide 138

Slide 138 text

18 . 2

Slide 139

Slide 139 text

18 . 3

Slide 140

Slide 140 text

18 . 4

Slide 141

Slide 141 text

18 . 5

Slide 142

Slide 142 text

18 . 6

Slide 143

Slide 143 text

18 . 7

Slide 144

Slide 144 text

18 . 8

Slide 145

Slide 145 text

18 . 9

Slide 146

Slide 146 text

18 . 10

Slide 147

Slide 147 text

19

Slide 148

Slide 148 text

20