Your SlideShare is downloading. ×
0
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Git primer
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Git primer

3,668

Published on

A brief introduction to distributed version control with git. …

A brief introduction to distributed version control with git.
Shamelessly adapted from Scott Chacon's excellent "Getting Git" talk: http://www.slideshare.net/chacon/getting-git

Published in: Education, Technology, Business
1 Comment
4 Likes
Statistics
Notes
No Downloads
Views
Total Views
3,668
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
89
Comments
1
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Inspired by:Getting Git by Scott Chacon — http://www.slideshare.net/chacon/getting-gitThe git Community Book — http://book.git-scm.com/index.htmlPicture: Larry the Cable Guy
  • Transcript

    • 1. gitr’ done!
      A brief introduction to
      distributed version control with git
      Oscar Nierstrasz — University of Bern — scg.unibe.ch
    • 2. Why git?
    • 3. Bob
    • 4. Bob
      Carol
    • 5. Bob
      Carol
      Alice
      Ted
    • 6. Bob
      Carol
      Alice
      Ted
      A recipe for disaster!
    • 7. The git object model
    • 8. A “blob” is content under version control (a file)
      blob
    • 9. You can have trees of blobs
      (directories of files)
      tree
      blob
      tree
      blob
      blob
    • 10. A “commit” is a tree of blobs
      (a set of changes)
      commit
      tree
      blob
      tree
      blob
      blob
    • 11. Most commits modify (or merge) earlier commits
      commit
      commit
      tree
      tree
      blob
      blob
      tree
      blob
      blob
    • 12. You can “tag” an interesting commit
      tag
      commit
      commit
      tree
      tree
      blob
      blob
      tree
      blob
      blob
    • 13. A graph of commits may belong to a branch
      branch
      tag
      commit
      commit
      tree
      tree
      blob
      blob
      tree
      blob
      blob
    • 14. HEAD
      “HEAD “is the current branch
      branch
      tag
      commit
      commit
      tree
      tree
      blob
      blob
      tree
      blob
      blob
    • 15. HEAD
      branch
      commit
      commit
      Let’s focus on commits and branches
    • 16. Basic git
    • 17. Create a git repo
      HEAD
      mkdir repo
      cd repo
      git init
      master
      C0
    • 18. Tell git to “stage” changes
      HEAD
      git add …
      master
      C0
    • 19. HEAD
      Commit your changes
      master
      C1
      git commit …
      C0
    • 20. Collaborating
    • 21. John
      Jane
      Public repo
      Local repo
      Local repo
      master
      C1
      C0
    • 22. John
      Jane
      Public repo
      Local repo
      Local repo
      git clone …
      master
      master
      master
      C1
      C1
      C1
      C0
      C0
      C0
      git clone …
    • 23. John
      Jane
      Public repo
      Local repo
      Local repo
      master
      master
      master
      C1
      C2
      C3
      C0
      C1
      C1
      C0
      C0
      git add …
      git commit …
      git add …
      git commit …
    • 24. John
      Jane
      Public repo
      Local repo
      Local repo
      git pull
      master
      master
      master
      C1
      C2
      C3
      C0
      C1
      C1
      C0
      C0
      (nothing new to pull)
    • 25. John
      Jane
      Public repo
      Local repo
      Local repo
      git push
      master
      master
      master
      C2
      C2
      C3
      C1
      C1
      C1
      C0
      C0
      C0
    • 26. John
      Jane
      Public repo
      Local repo
      Local repo
      git fetch
      master
      master
      master
      C2
      C2
      C3
      C2
      C1
      C1
      C1
      C0
      C0
      C0
    • 27. John
      Jane
      Public repo
      Local repo
      Local repo
      git merge
      master
      master
      master
      C2
      C4
      C2
      C3
      C2
      C1
      C1
      C1
      C0
      C0
      C0
      NB:git pull = fetch + merge
    • 28. John
      Jane
      Public repo
      Local repo
      Local repo
      git push
      master
      master
      master
      C4
      C4
      C2
      C3
      C2
      C3
      C2
      C1
      C1
      C1
      C0
      C0
      C0
    • 29. John
      Jane
      Public repo
      Local repo
      Local repo
      git pull
      master
      master
      master
      C4
      C4
      C4
      C3
      C3
      C2
      C2
      C3
      C2
      C1
      C1
      C1
      C0
      C0
      C0
    • 30. Branching and merging
    • 31. “origin” refers to the remote repo
      HEAD
      master
      origin/master
      C1
      C0
    • 32. HEAD
      master

      git commit …
      origin/master
      C2
      C1
      C0
    • 33. git branch tryout
      HEAD
      tryout
      master
      origin/master
      C2
      C1
      C0
    • 34. git checkout tryout
      HEAD
      tryout
      master
      origin/master
      C2
      C1
      NB:git checkout –b … = branch + checkout
      C0
    • 35. HEAD
      tryout
      master
      git commit …
      C3
      origin/master
      C2
      C1
      C0
    • 36. HEAD
      tryout
      master
      C3
      C5
      origin/master
      C2
      C1
      origin/idea
      C4
      C6
      C0
      git fetch origin
    • 37. git merge origin/master origin/idea
      HEAD
      tryout
      C7
      master
      C3
      origin/master
      C5
      C2
      C1
      C4
      C6
      C0
      origin/idea
    • 38. git checkout master
      tryout
      HEAD
      C7
      master
      C3
      origin/master
      C5
      C2
      C1
      C4
      C6
      C0
      origin/idea
    • 39. git merge
      HEAD
      tryout
      master
      C7
      C8
      C3
      origin/master
      C5
      C2
      C1
      C4
      C6
      C0
      origin/idea
    • 40. git push
      HEAD
      tryout
      master
      C7
      origin/master
      C8
      C3
      C5
      C2
      C1
      C4
      C6
      C0
      origin/idea
    • 41. More to git
    • 42. More to git …
      Merging and mergetool
      Squashing commits when merging
      Resolving conflicts
      User authentication with ssh
      gitx and other graphical tools
      git configure — remembering your name
      git remote — multiple remote repos
      github — an open source public repo

    • 43. Resources
      http://book.git-scm.com/index.html
      http://git-scm.com/
      https://github.com/
      http://www.slideshare.net/chacon/getting-git
      http://oreilly.com/
    • 44. License
      Attribution-ShareAlike 2.5
      You are free:
      • to copy, distribute, display, and perform the work
      • 45. to make derivative works
      • 46. to make commercial use of the work
      Under the following conditions:
      Attribution. You must attribute the work in the manner specified by the author or licensor.
      Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one.
      • For any reuse or distribution, you must make clear to others the license terms of this work.
      • 47. Any of these conditions can be waived if you get permission from the copyright holder.
      Your fair use and other rights are in no way affected by the above.
      http://creativecommons.org/licenses/by-sa/2.5/

    ×