Slide 1

Slide 1 text

Git 1 2 3! A fast introduction to git for professionals Jordan Schatz [email protected] You can fork this presentation at: https://github.com/shofetim/git-1-2-3 1

Slide 2

Slide 2 text

1: What is Git? 2

Slide 3

Slide 3 text

What is Git? Git is: + a source code management tool + distributed + fast 3

Slide 4

Slide 4 text

What is Git? Linus Torvolds wrote Git to solve a problem + All existing version control systems where broken + There where about 30,000 developers working on the kernel which made other VCS painful to use + He needed something that made his work faster 4

Slide 5

Slide 5 text

Solution: Git 5

Slide 6

Slide 6 text

Quick Note Why the name ’git’ ? Quoting Linus: "I’m an egotistical ***, and I name all my projects after myself. First ’Linux’, now ’git’" 6

Slide 7

Slide 7 text

What is Git good for? Git is a Source Code Management system, not a version control system. 7

Slide 8

Slide 8 text

What is Git good for? Git is a Source Code Management system, not a version control system. + Efficient Sharing 8

Slide 9

Slide 9 text

What is Git good for? Git is a Source Code Management system, not a version control system. + Efficient Sharing + Code Review 9

Slide 10

Slide 10 text

What is Git good for? Git is a Source Code Management system, not a version control system. + Efficient Sharing + Code Review + Documentation 10

Slide 11

Slide 11 text

What is Git good for? Git is a Source Code Management system, not a version control system. + Efficient Sharing + Code Review + Documentation + Security / Integrity 11

Slide 12

Slide 12 text

What is Git good for? Git is a Source Code Management system, not a version control system. + Efficient Sharing + Code Review + Documentation + Security / Integrity + Versioning 12

Slide 13

Slide 13 text

What is Git good for? Git is a Source Code Management system, not a version control system. + Efficient Sharing + Code Review + Documentation + Security / Integrity + Versioning + Debugging 13

Slide 14

Slide 14 text

What is Git good for? Git is a Source Code Management system, not a version control system. + Efficient Sharing + Code Review + Documentation + Security / Integrity + Versioning + Debugging + A simple continuous integration server 14

Slide 15

Slide 15 text

What is Git good for? Git is a Source Code Management system, not a version control system. + Efficient Sharing + Code Review + Documentation + Security / Integrity + Versioning + Debugging + A simple continuous integration server + more cool tools 15

Slide 16

Slide 16 text

The single most important thing you get is that: Experimentation Is Inexpensive 16

Slide 17

Slide 17 text

Stop pussyfooting around your codebase... and start striding around like a giant 17

Slide 18

Slide 18 text

Aside You don’t have to just use git for source code 18

Slide 19

Slide 19 text

Types of code that I use git for: + Ledger https://github.com/jwiegley/ledger 19

Slide 20

Slide 20 text

Types of code that I use git for: + Emacs Org mode http://orgmode.org/ Appointments Notes Project management Time logs Passwords Project Proposals Research papers Code documentation 20

Slide 21

Slide 21 text

Types of code that I use git for: + Calendar http://www.roaringpenguin.com/products/remind 21

Slide 22

Slide 22 text

Types of code that I use git for: + Diagrams http://ditaa.sourceforge.net/ 22

Slide 23

Slide 23 text

Types of code that I use git for: + Presentations http://docs.racket-lang.org/slideshow/index.html 23

Slide 24

Slide 24 text

Types of code that I use git for: + Just about everything else too 24

Slide 25

Slide 25 text

2: Get Git 25

Slide 26

Slide 26 text

Where to get it? Git http://git-scm.com/ Linux Mac Windows 26

Slide 27

Slide 27 text

How it works + Commits 27

Slide 28

Slide 28 text

How it works + Commits + sha1 28

Slide 29

Slide 29 text

How it works + Commits + sha1 (sha1 (open-input-string "hello world")) "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed" 29

Slide 30

Slide 30 text

How it works + Commits + sha1 (sha1 (open-input-string "hello world")) "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed" + diff & patch 30

Slide 31

Slide 31 text

How it works + Commits + sha1 (sha1 (open-input-string "hello world")) "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed" + diff & patch + working directory | index | repository 31

Slide 32

Slide 32 text

That working directory | index | repository thing 32

Slide 33

Slide 33 text

3: Try it out 33

Slide 34

Slide 34 text

Git Commands git config Get and set repository or global options. git config --global user.name "Jordan Schatz" git config --global user.email "[email protected]" 34

Slide 35

Slide 35 text

Git Commands git init Create an empty git repository. 35

Slide 36

Slide 36 text

Git Commands git add Add file contents to the index. 36

Slide 37

Slide 37 text

Git Commands git status Show the working tree status. 37

Slide 38

Slide 38 text

Git Commands git commit Record changes to the repository. 38

Slide 39

Slide 39 text

Git Commands gitk The git repository browser. 39

Slide 40

Slide 40 text

Git Commands git log Show commit logs. 40

Slide 41

Slide 41 text

Git Commands git clone Clone a repository into a new directory. 41

Slide 42

Slide 42 text

Git Commands git branch List, create, or delete branches. 42

Slide 43

Slide 43 text

Git Commands git checkout Checkout a branch or paths to the working tree. 43

Slide 44

Slide 44 text

Git Commands git push Update remote refs along with associated objects. 44

Slide 45

Slide 45 text

Git Commands git fetch Download objects and refs from another repository. 45

Slide 46

Slide 46 text

Git Commands git pull Fetch from and merge with another repository or a local branch. 46

Slide 47

Slide 47 text

Git Commands git remote manage set of tracked repositories. 47

Slide 48

Slide 48 text

Git Commands git stash Stash the changes in a dirty working directory away. 48

Slide 49

Slide 49 text

Git Commands git diff Show changes between commits, commit and working tree, etc. 49

Slide 50

Slide 50 text

Git Commands git clean Remove untracked files from the working tree. 50

Slide 51

Slide 51 text

Git Commands git merge Join two or more development histories together. 51

Slide 52

Slide 52 text

Git Commands git rebase Forward-port local commits to the updated upstream head. 52

Slide 53

Slide 53 text

Git Commands git fsck Verifies the connectivity and validity of the objects in the database. 53

Slide 54

Slide 54 text

Git Commands git gc Cleanup unnecessary files and optimize the local repository. 54

Slide 55

Slide 55 text

Git Commands git prune Prune all unreachable objects from the object database. 55

Slide 56

Slide 56 text

Git Commands git tag Create, list, delete or verify a tag object signed with GPG. 56

Slide 57

Slide 57 text

Git Commands git grep Print lines matching a pattern. 57

Slide 58

Slide 58 text

Git Commands git blame Show what revision and author last modified each line of a file. 58

Slide 59

Slide 59 text

Git Commands git gui A portable graphical interface to Git. 59

Slide 60

Slide 60 text

Git Commands git cherry-pick Apply the changes introduced by some existing commits. 60

Slide 61

Slide 61 text

Git Commands git bisect Find by binary search the change that introduced a bug. 61

Slide 62

Slide 62 text

Git Commands git show Show various types of objects. 62

Slide 63

Slide 63 text

Git Commands git format-patch Prepare patches for e-mail submission. 63

Slide 64

Slide 64 text

Git Commands git am Apply a series of patches from a mailbox. 64

Slide 65

Slide 65 text

Git Commands git reset Reset current HEAD to the specified state. 65

Slide 66

Slide 66 text

Git Commands git rm Remove files from the working tree and from the index. 66

Slide 67

Slide 67 text

Git Commands git archive Create an archive of files from a named tree. 67

Slide 68

Slide 68 text

Git Commands git mv Move or rename a file, a directory, or a symlink. 68

Slide 69

Slide 69 text

Git Commands git revert Revert some existing commits. 69

Slide 70

Slide 70 text

Git Commands git shortlog Summarize git log output. 70

Slide 71

Slide 71 text

Addendum 71

Slide 72

Slide 72 text

Gotcha’s + Git tracks content, not files. 72

Slide 73

Slide 73 text

Gotcha’s + Git tracks content, not files. + .gitignore 73

Slide 74

Slide 74 text

Gotcha’s + Git tracks content, not files. + .gitignore + git push (it does the right thing but) 74

Slide 75

Slide 75 text

Gotcha’s + Git tracks content, not files. + .gitignore + git push (it does the right thing but) + making commits/checkouts as root 75

Slide 76

Slide 76 text

Gotcha’s + Git tracks content, not files. + .gitignore + git push (it does the right thing but) + making commits/checkouts as root + chmod’ing the hooks when you didn’t mean too... 76

Slide 77

Slide 77 text

Tools + Github https://github.com/ 77

Slide 78

Slide 78 text

Tools + Github https://github.com/ + Deploy HQ http://www.deployhq.com/ 78

Slide 79

Slide 79 text

Tools + Github https://github.com/ + Deploy HQ http://www.deployhq.com/ + Gource http://code.google.com/p/gource/ 79

Slide 80

Slide 80 text

Tools + Github https://github.com/ + Deploy HQ http://www.deployhq.com/ + Gource http://code.google.com/p/gource/ + Gitosis http://scie.nti.st/2007/11/14/ hosting-git-repositories-the-easy-and-secure-way 80