Improve Your Development
Process with Git
Lachlan Hardy




@lachlanhardy
What is Git?
• Open source
What is Git?
• Open source
• Distributed version control system
What is Git?
• Open source
• Distributed version control system
• Designed for speed and efficiency
What is Git?
Open source - git-scm.com
What is Git?
Distributed
• local copy is a full copy
What is Git?
Distributed
• local copy is a full copy
• local copy is a backup
What is Git?
Distributed
• local copy is a full copy
• local copy is a backup
• commit to local copy
What is Git?
Distributed
•   local copy is a full copy
•   local copy is a backup
•   commit to local copy
•   work offline
What is Git?
Work offline
• perform diffs
What is Git?
Work offline
• perform diffs
• commit changes
What is Git?
Work offline
• perform diffs
• commit changes
• switch branches
What is Git?
Work offline
•   perform diffs
•   commit changes
•   switch branches
•   merge branches
What is Git?
Speed and Efficiency
• Snapshots, not deltas
What is Git?
Speed and Efficiency
• Snapshots, not deltas
• Commit-based logic
What is Git?
Speed and Efficiency
• Snapshots, not deltas
• Commit-based logic
• Each commit has access to full history
Setting up a repository
Configuration
• $ git config --global user.name “Lachlan Hardy”
• $ git config --global user.email
  ...
Setting up a repository
Create
• $ cd example/
• $ git init
• master $ touch README
• master $ git add .
• master $ git co...
Setting up a repository
Clone
• $ git clone git://example.com/repository/
  example.git
• $ cd example/
Developer Workflow
• Topic Branching
Developer Workflow
• Topic Branching
• Commit work locally
Developer Workflow
• Topic Branching
• Commit work locally
• Update local copy
Developer Workflow
•   Topic Branching
•   Commit work locally
•   Update local copy
•   Merge work to trunk and push to se...
Developer Workflow
Topic Branching
• master $ git pull origin master
Developer Workflow
Topic Branching
• master $ git pull origin master
• master $ git checkout -b new-feature
Developer Workflow
Topic Branching
• master $ git pull origin master
• master $ git checkout -b new-feature
• new-feature $...
Developer Workflow
Commit work locally
• new-feature $ git status
Developer Workflow
Commit work locally
• new-feature $ git status
• new-feature $ git add changed-file.txt
Developer Workflow
Commit work locally
• new-feature $ git status
• new-feature $ git add changed-file.txt
• new-feature $ g...
Developer Workflow
Update local copy
• new-feature $ git checkout master
Developer Workflow
Update local copy
• new-feature $ git checkout master
• master $ git pull origin master
Developer Workflow
Merge work to trunk and push to
 server
• master $ git merge new-feature
Developer Workflow
Merge work to trunk and push to
 server
• master $ git merge new-feature
• master $ git push origin mast...
Working in a team
• Work locally
Working in a team
• Work locally
• Share work without a server
Working in a team
• Work locally
• Share work without a server
• Test code locally in isolation
Working in a team
•   Work locally
•   Share work without a server
•   Test code locally in isolation
•   Commit to the se...
Working in a team
• Work locally
• Share work without a server
• Test code locally in isolation
• Commit to the server wit...
Questions?
• lachlan@lachstock.com.au
• @lachlanhardy
• http://git-scm.com/
Improve Your Development Process with Git
Improve Your Development Process with Git
Improve Your Development Process with Git
Improve Your Development Process with Git
Improve Your Development Process with Git
Improve Your Development Process with Git
Improve Your Development Process with Git
Improve Your Development Process with Git
Upcoming SlideShare
Loading in …5
×

Improve Your Development Process with Git

4,437 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
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,437
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
93
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide















































  • 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/

    ×