Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Improve Your Development Process with Git

Improve Your Development Process with Git

An introduction to the benefits of Git for your development process that I gave at cf.Objective(ANZ) 2011.

Lachlan Hardy

November 17, 2011
Tweet

More Decks by Lachlan Hardy

Other Decks in Programming

Transcript

  1. Who am I? ✦ Lachlan Hardy ✦ I lead development

    at Ninefold ✦ I’ve lead teams at News Digital Media, Atlassian and BigPond IPTV
  2. Who am I? ✦ Lachlan Hardy ✦ I lead development

    at Ninefold ✦ I’ve lead teams at News Digital Media, Atlassian and BigPond IPTV ✦ I like Ruby, JavaScript and making awesome web stuff.
  3. What is Git? ✦ Open source ✦ Distributed version control

    system ✦ Designed for speed and efficiency
  4. What is Git? ✦ local copy is a full copy

    ✦ local copy is a backup Distributed
  5. What is Git? ✦ local copy is a full copy

    ✦ local copy is a backup ✦ commit to local copy Distributed
  6. What is Git? ✦ local copy is a full copy

    ✦ local copy is a backup ✦ commit to local copy ✦ work offline Distributed
  7. What is Git? ✦ perform diffs ✦ commit changes ✦

    switch branches ✦ merge branches Work Offline
  8. What is Git? ✦ Snapshots, not deltas ✦ Commit-based logic

    ✦ Each commit has access to full history Speed and Efficiency
  9. Setting up a repository $ git config --global user.name “Lachlan

    Hardy” $ git config --global user.email “[email protected]” Configuration
  10. Setting up a repository $ cd example/ $ git init

    master $ touch README master $ git add . master $ git commit -m “This is my first commit.” Create
  11. Developer Workflow ✦ Topic Branching ✦ Commit work locally ✦

    Update local copy ✦ Merge work to trunk and push to server
  12. Developer Workflow master $ git pull origin master master $

    git checkout -b new-feature Topic Branching
  13. Developer Workflow master $ git pull origin master master $

    git checkout -b new-feature new-feature $ ...do some stuff... Topic Branching
  14. Developer Workflow new-feature $ git status new-feature $ git add

    changed-file.txt new-feature $ git commit -a “I changed a file” Commit Work Locally
  15. Developer Workflow master $ git merge new-feature master $ git

    push origin master Merge Work to Trunk and Push to Server
  16. Working in a team ✦ Work locally ✦ Share work

    without a server ✦ Test code locally in isolation
  17. Working in a team ✦ Work locally ✦ Share work

    without a server ✦ Test code locally in isolation ✦ Commit to the server without breaking builds
  18. Working in a team ✦ Work locally ✦ Share work

    without a server ✦ Test code locally in isolation ✦ Commit to the server without breaking builds ✦ A broken build doesn’t stop development