Slide 1

Slide 1 text

Commandless Git https://www.flickr.com/photos/sfxeric/4578550858

Slide 2

Slide 2 text

Alex Tercete @alextercete Rio de Janeiro, Brazil EnergyHelpline

Slide 3

Slide 3 text

https://www.flickr.com/photos/cdevers/3292421477

Slide 4

Slide 4 text

https://www.flickr.com/photos/cdevers/4618787095

Slide 5

Slide 5 text

https://www.flickr.com/photos/cdevers/4618786545

Slide 6

Slide 6 text

Simplified Model

Slide 7

Slide 7 text

Engine Fuel Transmission Wheels Brakes Steering

Slide 8

Slide 8 text

Engine Fuel Transmission Wheels Brakes Steering

Slide 9

Slide 9 text

Engine Fuel Transmission Wheels Brakes Steering

Slide 10

Slide 10 text

Engine Fuel Transmission Wheels Brakes Steering

Slide 11

Slide 11 text

Brakes Engine Fuel Transmission Wheels Steering

Slide 12

Slide 12 text

Makes things intuitive

Slide 13

Slide 13 text

Brakes Engine Fuel Transmission Wheels Steering Brake

Slide 14

Slide 14 text

Brakes Engine Fuel Transmission Wheels Steering

Slide 15

Slide 15 text

Brakes Engine Fuel Transmission Wheels Steering

Slide 16

Slide 16 text

It works, but not as it was meant to

Slide 17

Slide 17 text

Brakes Engine Fuel Transmission Wheels Steering

Slide 18

Slide 18 text

Brakes Engine Fuel Transmission Wheels Steering

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Working directory Staging area path/to/A.txt path/to/B.txt Files database Add

Slide 21

Slide 21 text

Working directory Staging area path/to/A.txt path/to/B.txt Files database

Slide 22

Slide 22 text

Working directory Staging area path/to/A.txt path/to/B.txt Files database Hash generation SHA1 c3

Slide 23

Slide 23 text

Working directory Staging area path/to/A.txt path/to/B.txt Files database Hash generation c3 SHA1

Slide 24

Slide 24 text

Working directory Staging area path/to/A.txt path/to/B.txt Files database c3

Slide 25

Slide 25 text

Working directory Staging area path/to/A.txt path/to/B.txt Files database c3

Slide 26

Slide 26 text

Working directory Staging area path/to/A.txt c3 path/to/A.txt path/to/B.txt Files database c3

Slide 27

Slide 27 text

Working directory Staging area path/to/A.txt c3 path/to/A.txt path/to/B.txt Files database c3 Hash generation SHA1 ed

Slide 28

Slide 28 text

Working directory Staging area path/to/A.txt c3 path/to/A.txt path/to/B.txt Files database c3 Hash generation SHA1 ed ed

Slide 29

Slide 29 text

c3 ed Files database Working directory Staging area path/to/A.txt c3 path/to/A.txt path/to/B.txt

Slide 30

Slide 30 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt c3 ed path/to/A.txt path/to/B.txt

Slide 31

Slide 31 text

– Hash is generated for the file’s content – Generated hash is the same for identical inputs – Files are saved to the files database – Changes are added to the staging area Add

Slide 32

Slide 32 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt c3 ed path/to/A.txt path/to/B.txt Commit

Slide 33

Slide 33 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt c3 ed path/to/A.txt path/to/B.txt

Slide 34

Slide 34 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt c3 ed path/to/A.txt path/to/B.txt Hash generation SHA1 ca c3 ed

Slide 35

Slide 35 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt c3 ed path/to/A.txt path/to/B.txt Hash generation SHA1 ca c3 ed path/to/A.txt path/to/B.txt c3 ed Commit ca

Slide 36

Slide 36 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt path/to/A.txt path/to/B.txt c3 ed Commit ca

Slide 37

Slide 37 text

c3 ed Files database Working directory Staging area Commit ca path/to/A.txt path/to/B.txt path/to/A.txt path/to/B.txt c3 ed Commits tree ca

Slide 38

Slide 38 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca

Slide 39

Slide 39 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt

Slide 40

Slide 40 text

c3 ed Files database Working directory Staging area path/to/A.txt Commits tree ca path/to/B.txt other/path/to/C.txt

Slide 41

Slide 41 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt path/to/B.txt other/path/to/C.txt 17 2b 17 2b

Slide 42

Slide 42 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt path/to/B.txt other/path/to/C.txt 17 2b 17 2b Hash generation SHA1 c3 17 7b 2b ca path/to/A.txt path/to/B.txt c3 17 Commit 7b other/path/to/C.txt 2b

Slide 43

Slide 43 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b path/to/A.txt path/to/B.txt c3 17 Commit 7b other/path/to/C.txt 2b 7b

Slide 44

Slide 44 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b

Slide 45

Slide 45 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b

Slide 46

Slide 46 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b other/path/to/C.txt 6d 6d

Slide 47

Slide 47 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b other/path/to/C.txt 6d 6d Hash generation SHA1 c3 17 6d path/to/A.txt path/to/B.txt c3 17 Commit 33 other/path/to/C.txt 6d 33 7b

Slide 48

Slide 48 text

c3 ed Files database Working directory Staging area path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33

Slide 49

Slide 49 text

– Hash is generated combining • Hash of the parent commit • Hashes of the files in the commit – Points to every file tracked by the repository – Staging area is cleared after the commit – Gets added to the commits tree Commit

Slide 50

Slide 50 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 Branch

Slide 51

Slide 51 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33

Slide 52

Slide 52 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33

Slide 53

Slide 53 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 feature/something 33

Slide 54

Slide 54 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 feature/something 33

Slide 55

Slide 55 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 feature/something 33 8e

Slide 56

Slide 56 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 33 master 33 feature/something 33 8e 4c

Slide 57

Slide 57 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 4c master 33 feature/something 4c 8e 4c

Slide 58

Slide 58 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 4c master 33 feature/something 4c 8e 4c

Slide 59

Slide 59 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 4c master 33 feature/something 4c 8e 4c ff

Slide 60

Slide 60 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 4c master 33 feature/something 4c 8e 4c ff 54

Slide 61

Slide 61 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54

Slide 62

Slide 62 text

– HEAD indicates the current commit being pointed to – There is nothing special about master – When on a branch, the reference gets updated after a commit Branch

Slide 63

Slide 63 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54 Checkout

Slide 64

Slide 64 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54

Slide 65

Slide 65 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD ca master 33 feature/something 54 8e 4c ff 54

Slide 66

Slide 66 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD ca master 33 feature/something 54 8e 4c ff 54

Slide 67

Slide 67 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca 17 2b 7b 6d 33 References HEAD ca master 33 feature/something 54 8e 4c ff 54

Slide 68

Slide 68 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54

Slide 69

Slide 69 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54

Slide 70

Slide 70 text

c3 ed Files database Working directory path/to/A.txt path/to/B.txt Commits tree ca other/path/to/C.txt 17 2b 7b 6d 33 References HEAD 54 master 33 feature/something 54 8e 4c ff 54

Slide 71

Slide 71 text

– Only HEAD moves – Files are copied from the files database into the working directory – Files database remains unaltered – Commits tree remains unaltered Checkout

Slide 72

Slide 72 text

Files database Commits tree ca 7b 33 References HEAD 54 master 33 feature/something 54 4c 54 c3 ed 17 2b 6d 8e ff Merge

Slide 73

Slide 73 text

Files database Commits tree ca 7b 33 References HEAD 54 master 33 feature/something 54 4c 54 c3 ed 17 2b 6d 8e ff

Slide 74

Slide 74 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 feature/something 54 4c 54 c3 ed 17 2b 6d 8e ff

Slide 75

Slide 75 text

Files database Commits tree ca 7b 33 References HEAD e6 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98

Slide 76

Slide 76 text

Files database Commits tree ca 7b 33 References HEAD e6 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 Merge NO CONFLICTS

Slide 77

Slide 77 text

Files database Commits tree ca 7b 33 References HEAD e6 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98

Slide 78

Slide 78 text

Files database Commits tree ca 7b 33 References HEAD 2f master 2f feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 2f

Slide 79

Slide 79 text

Files database Commits tree ca 7b 33 References HEAD e6 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 Merge WITH CONFLICTS

Slide 80

Slide 80 text

Files database Commits tree ca 7b 33 References HEAD e6 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98

Slide 81

Slide 81 text

Files database Commits tree ca 7b 33 References HEAD b5 master b5 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 57 b5

Slide 82

Slide 82 text

– Brings changes from other branch into current branch – Conflict resolution is done once – Commit has two parents Merge

Slide 83

Slide 83 text

Files database Commits tree ca 7b 33 References HEAD e6 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 Rebase NO CONFLICTS

Slide 84

Slide 84 text

Files database Commits tree ca 7b 33 References HEAD e6 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98

Slide 85

Slide 85 text

Files database Commits tree ca 7b 33 References HEAD 54 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98

Slide 86

Slide 86 text

Files database Commits tree ca 7b 33 References HEAD a2 master e6 feature/something 54 a2 e6 c3 ed 17 2b 6d 8e ff 98 4c 54

Slide 87

Slide 87 text

Files database Commits tree ca 7b 33 References HEAD 9f master e6 feature/something 54 a2 e6 c3 ed 17 2b 6d 8e ff 98 4c 9f 54

Slide 88

Slide 88 text

Files database Commits tree ca 7b 33 References HEAD 9f master e6 feature/something 9f a2 e6 c3 ed 17 2b 6d 8e ff 98 4c 9f 54

Slide 89

Slide 89 text

Files database Commits tree ca 7b 33 References HEAD 54 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98 Rebase WITH CONFLICTS

Slide 90

Slide 90 text

Files database Commits tree ca 7b 33 References HEAD 54 master e6 feature/something 54 4c 54 e6 c3 ed 17 2b 6d 8e ff 98

Slide 91

Slide 91 text

Files database Commits tree ca 7b 33 References HEAD dd master e6 feature/something 54 dd e6 c3 ed 17 2b 6d 8e ff 98 4c 54 7f

Slide 92

Slide 92 text

Files database Commits tree ca 7b 33 References HEAD b8 master e6 feature/something 54 dd e6 c3 ed 17 2b 6d 8e ff 98 4c 54 7f b8

Slide 93

Slide 93 text

Files database Commits tree ca 7b 33 References HEAD b8 master e6 feature/something b8 dd e6 c3 ed 17 2b 6d 8e ff 98 4c 54 7f b8

Slide 94

Slide 94 text

– Puts changes introduced by current branch onto other branch – Conflict resolution is done for each commit – No extra commits are made Rebase

Slide 95

Slide 95 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Push

Slide 96

Slide 96 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin

Slide 97

Slide 97 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree

Slide 98

Slide 98 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33

Slide 99

Slide 99 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d

Slide 100

Slide 100 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33

Slide 101

Slide 101 text

– There is nothing special about origin – Tracking branch gets updated before uploading data to the remote – The remote is just another repository Push

Slide 102

Slide 102 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33 Fetch

Slide 103

Slide 103 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33

Slide 104

Slide 104 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33 62 b0 0e fa

Slide 105

Slide 105 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33 62 b0 0e fa 0e fa

Slide 106

Slide 106 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master 33 c3 ed 17 2b 6d ca 7b 33 62 b0 0e fa 0e fa 62 b0

Slide 107

Slide 107 text

Files database Commits tree ca 7b 33 References HEAD 33 master 33 c3 ed 17 2b 6d origin http://url Remotes Remote origin Files database Commits tree origin/master b0 c3 ed 17 2b 6d ca 7b 33 62 b0 0e fa 0e fa 62 b0

Slide 108

Slide 108 text

– Tracking branch gets updated after downloading data from the remote – Merge or rebase can be performed afterwards Fetch

Slide 109

Slide 109 text

https://www.flickr.com/photos/inthe-arena/15501000164

Slide 110

Slide 110 text

Reset Stash Revert

Slide 111

Slide 111 text

http://git-scm.com/book

Slide 112

Slide 112 text

Alex Tercete @alextercete speakerdeck.com/alextercete/commandless-git

Slide 113

Slide 113 text

Thank you! https://www.flickr.com/photos/sfxeric/4578550858