Your SlideShare is downloading. ×
Quick Introduction to git
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

Quick Introduction to git

4,025
views

Published on


0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,025
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
261
Comments
0
Likes
7
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

Transcript

  • 1. Distributed version control with git— a brief introductionJoel KrebsSlides by Oscar Nierstrasz
  • 2. Why git?
  • 3. Bob
  • 4. Bob Carol
  • 5. Bob CarolAlice Ted
  • 6. Bob CarolAlice Ted A recipe for disaster!
  • 7. What is git?
  • 8. > Distributed revision control system> Originally developed by Linus Torvalds for the development of the Linux Kernel in 2005> Focus on speed and efficiency> Quite a unique design and therefore sometimes a bit scary and difficult to understand
  • 9. The git object model
  • 10. A “blob” is content under version control (a file) blob
  • 11. You can have trees of blobs (directories of files) tree blob tree blob blob
  • 12. A “commit” is a tree of blobs (a set of changes) commit tree blob tree blob blob
  • 13. Most commits modify (or merge) earlier commits commit commit tree tree blobblob treeblob blob
  • 14. You can “tag” aninteresting commit tag commit commit tree tree blob blob tree blob blob
  • 15. A graph of commitsmay belong to a branch branch tag commit commit tree tree blob blob tree blob blob
  • 16. HEAD “HEAD “is the current branch branch tag commit commit tree tree blobblob treeblob blob
  • 17. HEAD branch commit commitLet’s focus on commits and branches
  • 18. Basic git
  • 19. Create a git repo HEAD master C0
  • 20. Tell git to “stage” changesHEADmaster C0
  • 21. HEADmaster Commit your changes C1 C0
  • 22. Collaborating
  • 23. John JaneLocal repo Public repo Local repo master C1 C0
  • 24. John JaneLocal repo Public repo Local repo master master master C1 C1 C1 C0 C0 C0
  • 25. John JaneLocal repo Public repo Local repo master master master C2 C1 C3 C1 C0 C1 C0 C0
  • 26. John Jane Local repo Public repo Local repo master master master C2 C1 C3 C1 C0 C1 C0 C0(nothing new to pull)
  • 27. John JaneLocal repo Public repo Local repo master master master C2 C2 C3 C1 C1 C1 C0 C0 C0
  • 28. John JaneLocal repo Public repo Local repo master master master C2 C2 C3 C2 C1 C1 C1 C0 C0 C0
  • 29. John JaneLocal repo Public repo Local repo master master master C2 C2 C4 C1 C1 C3 C2 C0 C0 C1 C0 NB: git pull = fetch + merge
  • 30. John JaneLocal repo Public repo Local repo master master master C2 C4 C4 C1 C3 C2 C3 C2 C0 C1 C1 C0 C0
  • 31. John JaneLocal repo Public repo Local repo master master master C4 C4 C4 C3 C2 C3 C2 C3 C2 C1 C1 C1 C0 C0 C0
  • 32. Branchingand merging
  • 33. “origin” refers to the remote repo HEAD masterorigin/master C1 C0
  • 34. HEAD masterorigin/master C2 C1 C0
  • 35. HEAD tryout masterorigin/master C2 C1 C0
  • 36. HEAD tryout masterorigin/master C2 C1 NB: git checkout –b … = branch + checkout C0
  • 37. HEAD tryout master C3origin/master C2 C1 C0
  • 38. HEAD tryoutmaster C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
  • 39. HEAD tryout C7master C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
  • 40. tryoutHEAD C7master C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
  • 41. HEAD tryoutmaster C7 C8 C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
  • 42. HEAD tryout master C7origin/master C8 C3 C5 C2 C1 C4 C6 C0 origin/idea
  • 43. Overview git workflow Remote repository fetch push Local repository pull commit checkout Index (cache) HEAD add Working directory
  • 44. Getting started
  • 45. First steps> Follow instructions on P2 Blog for installation> Send your ssh public key to joel.krebs@students.unibe.ch> Create meaningful commits with according messages> Hints that make your life easier: —Create a .gitignore file —Always pull before you push —Don’t panic when merge conflicts occur
  • 46. More to git
  • 47. 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> …
  • 48. Resources http://git-scm.com/ http://book.git-scm.com/index.html http://gitready.com/ https://github.com/http://www.slideshare.net/chacon/getting-git http://oreilly.com/
  • 49. http://creativecommons.org/licenses/by-sa/3.0/

×