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

Getting Started with Source Control and Git

Getting Started with Source Control and Git

This is the slide deck from a workshop given by myself and Chris Hunt at #digpen IV Exeter on 10/03/12.

You can find more resources here: http://nickcharlton.net/posts/git-workshop and http://github.com/nickcharlton/git-workshop.

Ee2387213f2c289968ee703fd25ac02d?s=128

Nick Charlton

March 12, 2012
Tweet

Transcript

  1. Getting Started with Source Control and Git

  2. Chris Hunt http://thisisthechris.co.uk/ @thisisthechris Nick Charlton @nickcharlton http://nickcharlton.net/

  3. Source Control Keep track of files. Collaborate on the same

    project. Know who to blame.
  4. Git Distributed. FORGET ANYTHING ELSE YOU KNOW. Modern. Cool.

  5. Concepts

  6. Just a bunch of snapshots & labels. HEAD Commit Branch

    Tag
  7. Getting Git Debian/Ubuntu: # apt-get install git Mac (or Xcode):

    $ brew install git Windows: mysysgit
  8. Committing

  9. Working Directory Repository Staging vim file.c git add file.c git

    commit -m ‘Blargh’
  10. 6b67 78b5G HEAD “Initial Commit.” “Blargh”

  11. commit be0bb1ed7a722cfd569494d1ee2d7f22164a6019 Author: Nick Charlton <hello@nickcharlton.net> Date: Sun Feb 26

    16:41:43 2012 +0000 Commit message.. commit dcc5c23c9a3a391461070751bf739b648605eec9 Author: Nick Charlton <hello@nickcharlton.net> Date: Sun Feb 26 14:22:31 2012 +0000 Commit message. commit 6f9a28631ab8ce9c8aa29039f538c36b8308791e Author: Nick Charlton <hello@nickcharlton.net> Date: Sun Feb 26 14:09:34 2012 +0000 A very long commit message. Somewhere around 75 chars. commit 86d9f3c21f1720582f59a8fdd38279968c69a9da Author: Nick Charlton <hello@nickcharlton.net> Date: Sun Feb 26 11:07:20 2012 +0000 You can also use multiple lines. Then you can fit in the why. $ git log
  12. Messages Fixed stuff. Fixes loading bug. * View wasn’t instantiated

    correctly. * Need to alloc before using.
  13. Branching

  14. Split off from your main code base. Implement new features.

    Fix bugs. Try things out. Practically instantaneous.
  15. $ git branch new_branch $ git checkout new_branch $ git

    checkout -b new_branch
  16. 6b67 78b5G HEAD “testing” 6b67

  17. Merging

  18. Join branches together. Usually completely automatic. Pretty damn fast, too.

  19. $ git checkout master $ git merge new_branch

  20. 43tbL 78b5G “testing” 6b67 87b8 HEAD

  21. Remotes

  22. Collaborate. Back up. Even deploy.

  23. $ git remote add origin <url> $ git push origin

    master
  24. Tagging

  25. Ear mark commits. Handy for version numbers. Or other milestones.

  26. $ git tag v1.0

  27. A Workflow master feature branch

  28. More •Rebase •Submodules •???

  29. Resources Slides (et. al.) licensed under Creative Commons Attribution-ShareAlike 3.0.

    Thanks. • Blog Post: http://nickcharlton.net/posts/git-workshop • Resources: http://github.com/nickcharlton/git- workshop • Pro Git Book: http://progit.org/ • Git Reference: http://gitref.org/ • GitHub: https://github.com/