Git Basics

Git Basics

The basics of Git presented at the Git Virtual Summit (http://www.phparch.com/phparchitect-live-presents-the-virtual-git-summit/)

C6ec08260e13aa2d5e9a7519546bed27?s=128

David Coallier

February 01, 2012
Tweet

Transcript

  1. Git Basics The good and the ugly. @davidcoallier - Virtual

    Git Summit 2012
  2. What is Git? Distributed Version Control System @davidcoallier - Virtual

    Git Summit 2012
  3. Running it Walk before you run. @davidcoallier - Virtual Git

    Summit 2012
  4. Download it. http://bit.ly/git-get @davidcoallier - Virtual Git Summit 2012

  5. Principles Built on certain principles @davidcoallier - Virtual Git Summit

    2012
  6. The Objects blob, commit, tag, tree. @davidcoallier - Virtual Git

    Summit 2012
  7. The Blob Used to store file data. @davidcoallier - Virtual

    Git Summit 2012
  8. The Tree A directory of blobs and trees. @davidcoallier -

    Virtual Git Summit 2012
  9. The Commit A trees’ point in time. @davidcoallier - Virtual

    Git Summit 2012
  10. @davidcoallier - Virtual Git Summit 2012

  11. The Tag Tag it, release, done. @davidcoallier - Virtual Git

    Summit 2012
  12. Let’s just use it. git init @davidcoallier - Virtual Git

    Summit 2012
  13. Workflows Out of 2, we’ll cover the simplest. @davidcoallier -

    Virtual Git Summit 2012
  14. The Working Directory Your files. @davidcoallier - Virtual Git Summit

    2012
  15. The Index Some sort of staging. http://bit.ly/git-index @davidcoallier - Virtual

    Git Summit 2012
  16. The HEAD Your last commit. @davidcoallier - Virtual Git Summit

    2012
  17. Get on stage $ git add Filename @davidcoallier - Virtual

    Git Summit 2012
  18. Get on your HEAD $ git commit -m “Added file.”

    @davidcoallier - Virtual Git Summit 2012
  19. Push it real good $ git push origin master @davidcoallier

    - Virtual Git Summit 2012
  20. Failed push! You have no “REMOTE” @davidcoallier - Virtual Git

    Summit 2012
  21. Remotes Remote Repository Aliases @davidcoallier - Virtual Git Summit 2012

  22. Remotes Github @davidcoallier - Virtual Git Summit 2012

  23. Remotes $ git remote add <name> <url> $ git push

    <name>/master @davidcoallier - Virtual Git Summit 2012
  24. Branches The single most important thing. @davidcoallier - Virtual Git

    Summit 2012
  25. @davidcoallier - Virtual Git Summit 2012 master feature-X branch merge

  26. Check it out. Work on a “tree” @davidcoallier - Virtual

    Git Summit 2012
  27. Work on a feature $ git checkout -b user-acl @davidcoallier

    - Virtual Git Summit 2012
  28. Master work $ git checkout master @davidcoallier - Virtual Git

    Summit 2012
  29. Work on moar feature $ git checkout -b moar @davidcoallier

    - Virtual Git Summit 2012
  30. $ git status @davidcoallier - Virtual Git Summit 2012

  31. Staying up to date Sync with your remotes @davidcoallier -

    Virtual Git Summit 2012
  32. Don’t use pull Fetch and Merge $ git fetch @davidcoallier

    - Virtual Git Summit 2012
  33. So you broke it. Real life does happen. @davidcoallier -

    Virtual Git Summit 2012
  34. Replace a File $ git checkout -- <file> @davidcoallier -

    Virtual Git Summit 2012
  35. Replace All $ git fetch origin $ git reset --hard

    origin/master @davidcoallier - Virtual Git Summit 2012
  36. You can now init, add, commit, push, branch, manage remotes,

    push to remote, reset hard. @davidcoallier - Virtual Git Summit 2012
  37. Too lazy! All I want is to contribute to open

    source. @davidcoallier - Virtual Git Summit 2012
  38. Let’s try it. Do we have time? Let’s demo. @davidcoallier

    - Virtual Git Summit 2012
  39. Workflows Forks, branches, pull requests. @davidcoallier - Virtual Git Summit

    2012
  40. Tips Little bits and bobs. @davidcoallier - Virtual Git Summit

    2012
  41. git show <commit> Show me my commit. @davidcoallier - Virtual

    Git Summit 2012
  42. git show :/bug git show smart. @davidcoallier - Virtual Git

    Summit 2012
  43. Install Hub It’ll teach you. http://defunkt.io/hub/ @davidcoallier - Virtual Git

    Summit 2012
  44. HALP! http://bit.ly/git-help @davidcoallier - Virtual Git Summit 2012