Git in the Van HighEdWeb 2013

447 views

Published on

Learn the basics of using Git for version control

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • Error on slide #43 about branching. "Clones the repo" should be "Points to a commit on the repo"
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total views
447
On SlideShare
0
From Embeds
0
Number of Embeds
29
Actions
Shares
0
Downloads
3
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Git in the Van HighEdWeb 2013

  1. 1. Question Who uses revision control?! #TPR7!
  2. 2. DIY Revision Control •  Duplicate and rename •  Track Changes / Save as Version •  Recovering the last auto-save
  3. 3. “When you work within your confines, when you realize your limitations, that’s when you can break through them.”!
  4. 4. Revision Control Systems •  Track changes to a set of files •  Mostly text edits •  Usually source code
  5. 5. Common Systems •  Subversion (SVN) •  BitKeeper •  CVS, SVK, etc.
  6. 6. Compare Them All http://en.wikipedia.org/wiki/ Comparison_of_revision_control_software
  7. 7. Why Choose Git? •  Open Source (free) •  Distributed gives you autonomy •  Easy branching for experimenting
  8. 8. How Git Works #TPR7!
  9. 9. The Δ It’s Efficient •  Revisions, not versions •  Repo stores all changes – 1st  change:    git init! •  Each change links to previous
  10. 10. The 3 Areas •  Working Copy •  Staging Index •  Repo
  11. 11. Working Copy Staging Index Repo
  12. 12. “I was learning a lot of things fast.”!
  13. 13. An Analogy Packing a suitcase! #TPR7!
  14. 14. Step 1: All the Things! •  Take some shirts out of the closet •  Throw them on the bed
  15. 15. Working Copy Staging Index Repo
  16. 16. Step 2: Just These Things •  Choose a few shirts •  Prepare them for packing
  17. 17. Working Copy Staging Index Repo
  18. 18. Step 3: Pack the Things •  Put the shirts in the suitcase
  19. 19. Working Copy Staging Index Repo
  20. 20. An Example Packing pants!
  21. 21. Step 1 •  Take pants out of the closet •  Touched the pants – that’s an edit •  The pants are in your working copy
  22. 22. Working Copy Staging Index Repo
  23. 23. Step 2 •  Choose a few pants, fold them up •  Selected a change – that’s an add •  The pants are in your staging index
  24. 24. Working Copy Staging Index Repo
  25. 25. Step 3 •  Put the folded pants in your suitcase •  Packed the pants – that’s a commit •  The pants are in your repo
  26. 26. Working Copy Staging Index Repo
  27. 27. Another Example This time, with commands!!
  28. 28. Step 1 •  Take socks out of the drawer •  COMMAND: (none) – Git  compares  current  files  to  repo – Changes  go  in  working  copy   automatically
  29. 29. Working Copy Staging Index Repo
  30. 30. Step 2 •  Pick a few socks, roll them up •  COMMAND: git add – Moves changes to staging index – Works for edited files or new files
  31. 31. Working Copy Staging Index Repo git add
  32. 32. Step 3 •  Pack the socks in your suitcase •  COMMAND: git commit – Records the changes to your repo – Can be a single change or many
  33. 33. Working Copy Staging Index Repo git commit
  34. 34. Step 4 •  Put unused clothes away •  COMMAND: git checkout – Erases changes from the working copy – A good way to get out of a bad situation
  35. 35. Working Copy Working Copy git checkout!
  36. 36. Commit #1 Commit #2 Commit #3
  37. 37. “After all the weeks of practice I felt ready to play.”!
  38. 38. A Demo With Terminal and the GitHub app!
  39. 39. State of the Repo Sequential changes!
  40. 40. Commit #1 Commit #2 Commit #3 HEAD
  41. 41. Branches Want to try something?!
  42. 42. Making Branches git branch <name>! ! •  Clones the repo •  New working copy and staging index •  Git Flow – a branching model
  43. 43. Switching Branches git checkout <name>! •  Quickly swap to a different branch •  Changes what’s in your editor •  Changes what’s in the browser
  44. 44. An Example Going to Jamaica!
  45. 45. Rewind the Repo git checkout <commit2>! ! •  Set the HEAD to commit #2
  46. 46. Commit #1 Commit #2 Commit #3 HEAD
  47. 47. Commit #1 Commit #2 Commit #3 HEAD
  48. 48. Branch the Rewind git checkout – b <branchName>! •  Make a new branch off that commit
  49. 49. Master Jamaica
  50. 50. Working Copy Staging Index Repo
  51. 51. Get a Passport •  A new item, not yet tracked •  COMMAND: git add – Skip the working copy – Add directly to staging index !
  52. 52. Working Copy Staging Index Repo git add
  53. 53. Pack the Passport •  Pack the passport •  COMMAND: git commit – Add to the repo
  54. 54. Working Copy Staging Index Repo
  55. 55. Merge the Changes •  Add the change to the master branch •  COMMAND: git merge – Merge all changes or cherry pick
  56. 56. Master Jamaica
  57. 57. Master Jamaica
  58. 58. Demo Time Checkout prior commit, branch, merge
  59. 59. GitHub.com “Just do it like it’s all you knew how to do.”!
  60. 60. Learn More •  http://try.github.io •  “Git Essential Training” by Kevin Skoglund on Lynda.com •  http://git-scm.com/book
  61. 61. Clone This Rep ! https://github.com/ brufftech/git-suitcase.git
  62. 62. Credits •  Quotes from Get in the Van by Henry Rollins •  Designer:  Jacob  Melton    meltonjd@dukes.jmu.edu •  Presenter:  Annette  Liskey    liskeyab@jmu.edu
  63. 63. Questions?

×