$30 off During Our Annual Pro Sale. View Details »

Working with Git and GitHub

Working with Git and GitHub

An introduction to source control with Git and project collaboration using GitHub, from a presentation to Refresh DC on 2013 - 03 - 21. The slides were accompanied by live demos.

Matt Yoho

March 21, 2013
Tweet

More Decks by Matt Yoho

Other Decks in Programming

Transcript

  1. Working with Git
    and GitHub.
    Work better,
    together.

    View Slide

  2. My name is Matt Yoho.
    I write code at GitHub.
    @mattyoho

    View Slide

  3. Git
    Distributed version
    control.

    View Slide

  4. GitHub
    Social coding. Open
    source.

    View Slide

  5. GitHub
    Creative project
    collaboration.

    View Slide

  6. View Slide

  7. ?
    ?
    ?

    View Slide

  8. So, what is version
    control?

    View Slide

  9. So, what is version
    control?
    And why do I care?

    View Slide

  10. Let’s look at a daily
    workflow.

    View Slide

  11. 1. Create some files.
    2. Save some files.
    3. Edit some files.
    4. Save them again.

    View Slide

  12. 1. Create some files.
    2. Save some files.
    3. Edit some files.
    4. Save them again.

    View Slide

  13. 1. Create some files.
    2. Save some files.
    3. Edit some files.
    4. Save them again.

    View Slide

  14. 1. Create some files.
    2. Save some files.
    3. Edit some files.
    4. Save them again.

    View Slide

  15. 1. Create some files.
    2. Save some files.
    3. Edit some files.
    4. Save them again.

    View Slide

  16. Where was
    I again?!

    View Slide

  17. Alternatively...

    View Slide

  18. Experimentation

    View Slide

  19. X
    Experimentation

    View Slide

  20. X
    Experimentation

    View Slide

  21. X
    ?
    Experimentation

    View Slide

  22. Repos and commits

    View Slide

  23. Commits
    Commits capture the
    contents of a project’s files
    at a point in time.
    A repository contains all the
    commits for a project, and
    some other metadata.

    View Slide

  24. Commits
    Commits capture the
    contents of a project’s files
    at a point in time.
    A repository contains all the
    commits for a project, and
    some other metadata.
    A commit is like a savepoint.

    View Slide

  25. Stages of a file
    staged committed
    changed
    git add
    git commit
    edit

    View Slide

  26. Creating a repo

    View Slide

  27. $> mkdir ./my_project
    $> cd my_project
    $> git init .
    $>
    gitting started

    View Slide

  28. $> git init .
    $> git add [--all]
    $> git mv
    $> git commit [--amend]
    $>
    add commands

    View Slide

  29. $> git status
    $> git show
    $> git diff
    $> git log
    $>
    status commands

    View Slide

  30. Undoing things

    View Slide

  31. $> git add -u
    $> git rm
    $> git reset
    $> git revert
    $>
    undo commands

    View Slide

  32. Branches

    View Slide

  33. Master
    (branch)
    (m
    erge)
    Feature

    View Slide

  34. Branching and merging

    View Slide

  35. $> git branch
    $> git checkout [--branch]
    $> git merge
    $>
    branch commands

    View Slide

  36. The .git directory
    .git
    6effec72
    813a7a9c
    071ae029

    View Slide

  37. So, what’s the deal
    with GitHub?

    View Slide

  38. So, what’s the point
    of GitHub?
    Octocloud

    View Slide

  39. Working with remotes

    View Slide

  40. $> git remote
    $> git push
    $> git fetch
    $> git pull
    $>
    remote commands

    View Slide

  41. Git through the web UI

    View Slide

  42. That’s neat and all,
    but what about the
    collaboration stuff?

    View Slide

  43. Forking

    View Slide

  44. Pull Requests

    View Slide

  45. Pull Requests

    View Slide

  46. Forks, issues, and PRs

    View Slide

  47. Master
    O
    pen
    P
    R
    M
    erge
    P
    R
    Feature

    View Slide

  48. Master
    merge
    commit
    Log view

    View Slide

  49. Git tricks

    View Slide

  50. Rebasing commits

    View Slide

  51. GHforM
    GHforW

    View Slide

  52. Further
    Learning

    View Slide

  53. View Slide

  54. View Slide

  55. View Slide

  56. Thank you.
    http://git-scm.com/
    http://mac.github.com/
    http://windows.github.com/
    http://training.github.com/
    http://help.github.com/

    View Slide

  57. Thank you. Questions?
    http://git-scm.com/
    http://mac.github.com/
    http://windows.github.com/
    http://training.github.com/
    http://help.github.com/

    View Slide