Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Improve Your Development Process with Git

4,589 views

Published on

A basic intro to Git and development workflow that I gave at WebDU in Sydney, May 2010.

A pretty talky session, so there's not heaps of explanation on the slides, but hopefully they might be of use.

Published in: Technology
  • Be the first to comment

Improve Your Development Process with Git

  1. 1. Improve Your Development Process with Git Lachlan Hardy @lachlanhardy
  2. 2. What is Git? • Open source
  3. 3. What is Git? • Open source • Distributed version control system
  4. 4. What is Git? • Open source • Distributed version control system • Designed for speed and efficiency
  5. 5. What is Git? Open source - git-scm.com
  6. 6. What is Git? Distributed • local copy is a full copy
  7. 7. What is Git? Distributed • local copy is a full copy • local copy is a backup
  8. 8. What is Git? Distributed • local copy is a full copy • local copy is a backup • commit to local copy
  9. 9. What is Git? Distributed • local copy is a full copy • local copy is a backup • commit to local copy • work offline
  10. 10. What is Git? Work offline • perform diffs
  11. 11. What is Git? Work offline • perform diffs • commit changes
  12. 12. What is Git? Work offline • perform diffs • commit changes • switch branches
  13. 13. What is Git? Work offline • perform diffs • commit changes • switch branches • merge branches
  14. 14. What is Git? Speed and Efficiency • Snapshots, not deltas
  15. 15. What is Git? Speed and Efficiency • Snapshots, not deltas • Commit-based logic
  16. 16. What is Git? Speed and Efficiency • Snapshots, not deltas • Commit-based logic • Each commit has access to full history
  17. 17. Setting up a repository Configuration • $ git config --global user.name “Lachlan Hardy” • $ git config --global user.email “lhardy@atlassian.com”
  18. 18. Setting up a repository Create • $ cd example/ • $ git init • master $ touch README • master $ git add . • master $ git commit -m “This is my first commit.”
  19. 19. Setting up a repository Clone • $ git clone git://example.com/repository/ example.git • $ cd example/
  20. 20. Developer Workflow • Topic Branching
  21. 21. Developer Workflow • Topic Branching • Commit work locally
  22. 22. Developer Workflow • Topic Branching • Commit work locally • Update local copy
  23. 23. Developer Workflow • Topic Branching • Commit work locally • Update local copy • Merge work to trunk and push to server
  24. 24. Developer Workflow Topic Branching • master $ git pull origin master
  25. 25. Developer Workflow Topic Branching • master $ git pull origin master • master $ git checkout -b new-feature
  26. 26. Developer Workflow Topic Branching • master $ git pull origin master • master $ git checkout -b new-feature • new-feature $ ...do some stuff...
  27. 27. Developer Workflow Commit work locally • new-feature $ git status
  28. 28. Developer Workflow Commit work locally • new-feature $ git status • new-feature $ git add changed-file.txt
  29. 29. Developer Workflow Commit work locally • new-feature $ git status • new-feature $ git add changed-file.txt • new-feature $ git commit -a “I changed a file”
  30. 30. Developer Workflow Update local copy • new-feature $ git checkout master
  31. 31. Developer Workflow Update local copy • new-feature $ git checkout master • master $ git pull origin master
  32. 32. Developer Workflow Merge work to trunk and push to server • master $ git merge new-feature
  33. 33. Developer Workflow Merge work to trunk and push to server • master $ git merge new-feature • master $ git push origin master
  34. 34. Working in a team • Work locally
  35. 35. Working in a team • Work locally • Share work without a server
  36. 36. Working in a team • Work locally • Share work without a server • Test code locally in isolation
  37. 37. Working in a team • Work locally • Share work without a server • Test code locally in isolation • Commit to the server without breaking builds
  38. 38. 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
  39. 39. Questions? • lachlan@lachstock.com.au • @lachlanhardy • http://git-scm.com/

×