Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Git and Gerrit at the London JUG

Intro to Git and Gerrit at the London JUG

Matthew McCullough, Git Trainer at GitHub and Alex Blewitt introduce Git and Gerrit to the London JUG in October of 2011.

1) Great GitHub help pages:
http://help.github.com

2) A wonderful open source Git book from Scott Chacon:
http://progit.org

3) A free one-hour intro session offered approximately every one to four weeks:
https://github.com/blog/942-october-the-basics-of-github-free-class-dates

4) Office hours in which any Git or GitHub questions can be asked in a chat room:
https://github.com/blog/910-github-office-hours

5) A full day Git bootcamp class:
Training details and registration: http://github.com/training/online
Brochure link: http://dl.dropbox.com/u/53401/github/GitHub-Git-Training-Flyer-v2.0.pdf

6) On-site custom Git training.
http://github.com/training

7) O'Reiily's Git Master Class
http://bit.ly/ogitvid

Bededa744012c87721d68f69342f81b0?s=128

Matthew McCullough

October 20, 2011
Tweet

Transcript

  1. Introduction to Git & Gerrit at the London JUG by

    Matthew McCullough and Alex Blewitt
  2. Matthew McCullough @matthewmccull

  3. None
  4. None
  5. None
  6. None
  7. None
  8. Git

  9. None
  10. “Cool kids” version control system

  11. Open Source

  12. bash scripts ☛ C code

  13. None
  14. I'm an egotistical bastard, and I name all my projects

    after myself. First Linux, now git. -Linus Torvalds “ ”
  15. ➡How to commit, branch and tag ➡How Git implements a

    new commit-referencing syntax ➡How to pull and push changes between repositories ➡How to set up a Git repository
  16. ➡How to set up a Git repository

  17. No daemon

  18. No special repo area

  19. None
  20. > cd myproj > git init Initialized empty Git repository

    in /stuff/myproj/.git/
  21. None
  22. None
  23. ➡How to commit, branch and tag ➡How Git implements a

    new commit-referencing syntax ➡How to pull and push changes between repositories ➡How to set up a Git repository
  24. ➡How to commit, branch and tag

  25. The three basics

  26. None
  27. ➡How to commit

  28. > git add <FILENAME>

  29. None
  30. > git status # On branch master # Initial commit

    # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # new file: myfile.txt
  31. None
  32. > git commit -m”<MESSAGE>” [master (root-commit) 498cc44] My first commit

    1 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 myfile.txt
  33. Local Branches Remote Branches Upstream Branches Working Copy commit

  34. None
  35. ➡How to branch

  36. > git branch <BRANCHNAME>

  37. Local Branches Remote Branches Upstream Branches Working Copy

  38. None
  39. > git checkout <BRANCHNAME> Switched to branch 'mybranch'

  40. Local Branches Remote Branches Upstream Branches Working Copy

  41. None
  42. ➡How to tag

  43. > git tag -a <TAGNAME> -m”<MESSAGE>”

  44. None
  45. None
  46. ➡How to commit, branch and tag ➡How Git implements a

    new commit-referencing syntax ➡How to pull and push changes between repositories ➡How to set up a Git repository
  47. ➡How Git implements a new commit-referencing syntax

  48. None
  49. 9AB223D28B1AA46EF1780B22F304982E39872C34 <html> <body> <p>This is a test</p> <img src="http://ai.com/icon.gif"> </body>

    </html>
  50. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  51. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  52. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  53. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  54. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  55. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  56. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  57. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  58. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  59. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  60. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  61. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  62. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  63. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  64. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  65. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  66. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  67. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  68. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  69. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  70. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  71. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  72. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  73. > git log commit 0fc27c73dea82a0576c6cf262fb517d24e75a223 Author: Matthew McCullough <matthewm@ambientideas.com> Date:

    Mon Oct 24 10:42:20 2013 +0300 Performance enhancement of calc engine commit 7d946e814233814b1780ed1035da271cbb37206d Author: Matthew McCullough <matthewm@ambientideas.com> Date: Mon Oct 24 12:59:41 2013 +0300 Translation to Esperanto
  74. None
  75. None
  76. ➡How to commit, branch and tag ➡How Git implements a

    new commit-referencing syntax ➡How to pull and push changes between repositories ➡How to set up a Git repository
  77. ➡How to pull and push changes between repositories

  78. None
  79. > git clone http://this.com/myproj.git Cloning into myproj... remote: Counting objects:

    3871, done. remote: Compressing objects: 100% (73/73), done. remote: Total 3871 (delta 51), reused 3853 (delta 36) Receiving objects: 100% (3871/3871), 297.88 KiB | 35 KiB/s, done. Resolving deltas: 100% (51/51), done. > cd myproj
  80. Local Branches Remote Branches Upstream Branches Working Copy clone clone

    clone
  81. None
  82. > git push Counting objects: 16, done. Delta compression using

    up to 2 threads. Compressing objects: 100% (10/10), done. Writing objects: 100% (15/15), 1.37 KiB, done. Total 15 (delta 5), reused 0 (delta 0) To http://this.com/myproj.git 6128b94..7607971 master -> master
  83. Local Branches Remote Branches Upstream Branches Working Copy push push

    commit
  84. None
  85. > git pull Updating 474f43d..7607971 Fast-forward sample5.htm | 1 +

    1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 sample5.htm
  86. Local Branches Remote Branches Upstream Branches Working Copy pull pull

    pull
  87. None
  88. None
  89. Next: Alex Blewitt on Gerrit

  90. None
  91. Introduction to Git & Gerrit at the London JUG by

    Matthew McCullough and Alex Blewitt