think git

What is git?



Link



Link

git is a supplement to your workflow

Workflow

Edit files
$EDITOR
Save changes
git commit

git commit

What's your story

Big idea #1

git history is a graph

git functions

git help --all
usage: git [--version] [--help] [-C ] [-c name=value]
           [--exec-path[=]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=] [--work-tree=] [--namespace=]
            []

available git commands in '/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core'

  add                       clone                     fast-import               interpret-trailers        notes                     remote-testsvn            submodule
  add--interactive          column                    fetch                     log                       p4                        repack                    subtree
  am                        commit                    fetch-pack                ls-files                  pack-objects              replace                   svn
  annotate                  commit-tree               filter-branch             ls-remote                 pack-redundant            request-pull              symbolic-ref
  apply                     config                    fmt-merge-msg             ls-tree                   pack-refs                 rerere                    tag
  archimport                count-objects             for-each-ref              mailinfo                  patch-id                  reset                     unpack-file
  archive                   credential                format-patch              mailsplit                 prune                     rev-list                  unpack-objects
  bisect                    credential-cache          fsck                      merge                     prune-packed              rev-parse                 update-index
  bisect--helper            credential-cache--daemon  fsck-objects              merge-base                pull                      revert                    update-ref
  blame                     credential-osxkeychain    gc                        merge-file                push                      rm                        update-server-info
  branch                    credential-store          get-tar-commit-id         merge-index               quiltimport               send-email                upload-archive
  bundle                    cvsexportcommit           grep                      merge-octopus             read-tree                 send-pack                 upload-pack
  cat-file                  cvsimport                 gui--askpass              merge-one-file            rebase                    sh-i18n--envsubst         var
  check-attr                cvsserver                 hash-object               merge-ours                receive-pack              shell                     verify-commit
  check-ignore              daemon                    help                      merge-recursive           reflog                    shortlog                  verify-pack
  check-mailmap             describe                  http-backend              merge-resolve             relink                    show                      verify-tag
  check-ref-format          diff                      http-fetch                merge-subtree             remote                    show-branch               web--browse
  checkout                  diff-files                http-push                 merge-tree                remote-ext                show-index                whatchanged
  checkout-index            diff-index                imap-send                 mergetool                 remote-fd                 show-ref                  write-tree
  cherry                    diff-tree                 index-pack                mktag                     remote-ftp                stage
  cherry-pick               difftool                  init                      mktree                    remote-ftps               stash
  citool                    difftool--helper          init-db                   mv                        remote-http               status
  clean                     fast-export               instaweb                  name-rev                  remote-https              stripspace

git commands available from elsewhere on your $PATH

  loglive

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help ' or 'git help '
to read about a specific subcommand or concept.
git help --all
usage: git [--version] [--help] [-C ] [-c name=value]
           [--exec-path[=]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=] [--work-tree=] [--namespace=]
            []

available git commands in '/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core'

  add                       clone                                                                                                                             submodule
  add--interactive                                    fetch                     log
  am                        commit
  annotate
  apply                                                                                                                                                       tag
                                                                                                                                    reset
  archive                                             format-patch
  bisect                                                                        merge
  bisect--helper                                                                                          pull                      revert
  blame                                               gc                                                  push                      rm
  branch
                                                      grep
                                                      gui--askpass                                        rebase

                            daemon                    help                                                reflog

                            diff                                                                          remote
  checkout


  cherry-pick                                         init                                                                          stash
                                                                                mv                                                  status
  clean                                               instaweb

git commands available from elsewhere on your $PATH

  loglive

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help ' or 'git help '
to read about a specific subcommand or concept.

Workflow

git init
Edit files
$EDITOR
Group changes
git add
Review changes
git status
Save changes
git commit

git operations
Link

demo

commit structure
Link

commit structure
Link

demo

Big idea #2

Difference between Head, Index and Working directory
Link

Branches

git branch master

git checkout -b feature

git checkout master

git merge master

Big idea #3

branches are just labels

Merge Conflict

demo

Best Mergetools


Link

Changing history

git rebase master

demo

demo

Big idea #4

Local commits are yours to do with what you like

Remote

git operations
Link

git pull = git fetch + git merge

demo

Big idea #5

Remote is special branch, but a branch nonetheless

Review of big ideas

Difference between working directory, staging area and .git repository

Branches are just labels

Remote is a branch too

Local history is whatever you make it

Best practices

Commit often

Branches are inexpensive

Push to master only if tests pass

Write good commit messages!

Discuss workflow with team

Less of this and more of this

git-history

Source code for this presentation

git-repo

Additional slides

Advantages of git

  • Free
  • Fast
  • Secure
  • Supports multiple non linear workflows
  • Easy to learn

Free as in [beer, speech]


git-scm
Link

Small

The Mozilla project's CVS repository is about 3 GB; it's about 12 GB in Subversion's fsfs format. In Git it's around 300 MB.

Fast

init benchmarks init benchmarks init benchmarks init benchmarks init benchmarks init benchmarks
init benchmarks init benchmarks init benchmarks init benchmarks init benchmarks init benchmarks

Link

Distributed non linear workflows

Subversion-Style Workflow Workflow A
Link

Distributed non linear workflows

Integration Manager Workflow Workflow B
Link

Distributed non linear workflows

Dictator and Lieutenants Workflow Workflow C
Link

  • git is not GitHub
  • git is not Dropbox
  • git is not svn

CVS

Git

A brief history of Git

  • git is British English slang for "unpleasant person".
  • - Linus Torvalds likes to name projects after himself

The Parable by Tom Preston-Werner (Founder of GitHub)
The Git Parable
Link

git blame README git readme
Link

Article on Git in 2005
Link