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

Git for Humans

Git for Humans

A presentation I gave at UXBri.
Audio + Slides here: https://www.youtube.com/watch?v=eWxxfttcMts

Alice Bartlett

November 04, 2016
Tweet

More Decks by Alice Bartlett

Other Decks in Technology

Transcript

  1. Alice Bartlett
    Senior Developer, Financial Times
    @alicebartlett
    Git for humans

    View full-size slide

  2. HELLO
    @alicebartlett

    View full-size slide

  3. @alicebartlett
    GDS

    View full-size slide

  4. Things are just better
    when designers are
    involved
    @alicebartlett

    View full-size slide

  5. @alicebartlett
    “ What tools could you not
    live without that
    designers don’t have? ”

    View full-size slide

  6. Git
    @alicebartlett

    View full-size slide

  7. “ Git is an
    application that
    runs on your
    computer, like a
    web browser or a
    word processor ”
    Tom Stuart
    http://codon.com/
    “ Git is an
    application that
    runs on your
    computer, like a
    web browser or a
    word processor ”

    View full-size slide

  8. WHAT DOES IT DO?

    View full-size slide

  9. @alicebartlett
    Git helps you manage work
    done on projects.

    View full-size slide

  10. @alicebartlett
    GIT IS
    UNFRIENDLY

    View full-size slide

  11. @alicebartlett

    View full-size slide

  12. @alicebartlett
    There are other
    applications you can use to
    use Git.

    View full-size slide

  13. @alicebartlett
    JARGON

    View full-size slide

  14. @alicebartlett
    GIT

    View full-size slide

  15. @alicebartlett
    UNDERNEATH
    ALL THIS, GIT IS
    QUITE SIMPLE

    View full-size slide

  16. WHY
    ARE
    YOU
    HERE

    View full-size slide

  17. 1. THING 1
    2. THING 2
    3. THING 3
    4. THING 4
    5. THING 5

    View full-size slide

  18. GIT LETS YOU TELL
    THE STORY OF YOUR
    PROJECT
    THING 1:

    View full-size slide

  19. You use Git to take snapshots of
    all the files in a folder.
    This folder is called a repository
    or repo.
    @alicebartlett

    View full-size slide

  20. When you want to take a
    snapshot of a file or files, you
    create a commit
    @alicebartlett

    View full-size slide

  21. @alicebartlett
    logo.svg
    logo-2.svg
    logo-3-monica-feedback.svg
    logo-3-FINAL.svg
    logo-3-FINAL-1.svg

    View full-size slide

  22. @alicebartlett
    By saving copies By making commits

    View full-size slide

  23. @alicebartlett
    By saving copies By making commits
    logo.svg
    logo.svg

    View full-size slide

  24. @alicebartlett
    By saving copies By making commits
    logo.svg
    logo.svg
    logo.svg
    logo-2.svg
    commit

    View full-size slide

  25. @alicebartlett
    By saving copies By making commits
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo-2.svg
    logo-3-monica-feedback.svg
    commit

    View full-size slide

  26. @alicebartlett
    By saving copies By making commits
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo-2.svg
    logo-3-monica-feedback.svg
    logo-3-FINAL.svg
    commit

    View full-size slide

  27. @alicebartlett
    By saving copies By making commits
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo-2.svg
    logo-3-monica-feedback.svg
    logo-3-FINAL.svg
    logo-3-FINAL-1.svg
    commit

    View full-size slide

  28. @alicebartlett
    By saving copies By making commits
    logo.svg
    logo-2.svg
    logo-3-monica-feedback.svg
    logo-3-FINAL.svg
    logo-3-FINAL-1.svg
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo.svg

    View full-size slide

  29. When you commit a file or files,
    some information is saved along
    with the changes to the file
    @alicebartlett

    View full-size slide

  30. 1. Who
    2. When
    @alicebartlett

    View full-size slide

  31. You can add more information
    about the changes you’ve made
    in a commit message
    @alicebartlett

    View full-size slide

  32. Update link style
    User research showed that many people did not
    spot links in the copy. This commit updates the
    link style to the new underlined style which
    performed better.
    @alicebartlett
    A good commit message:

    View full-size slide

  33. @alicebartlett
    logo-3-FINAL-1.svg

    View full-size slide

  34. @alicebartlett
    By making commits
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    Alice Bartlett
    10:34am March 11th 2016
    Update link style
    User research showed that many people
    did not spot links in the copy. This
    commit updates the link style to the new
    underlined style which performed
    better.

    View full-size slide

  35. @alicebartlett
    By making commits
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    Alice Bartlett
    12:43pm May 5th 2016
    Add new colours
    New colours for US election campaign

    View full-size slide

  36. @alicebartlett
    By making commits
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    logo.svg
    Alice Bartlett
    12:43pm May 8th 2016
    Fix Orange
    The orange we used fails AAA
    accessibility contrast tests so beef it up
    to contrast properly

    View full-size slide

  37. Git stores the whole history
    of your project
    @alicebartlett
    20-09-2016: updated link style
    20-05-2016: added changes from monica
    20-06-2016: deleted save icon

    View full-size slide

  38. repository - your project folder
    commit - save a snapshot
    @alicebartlett

    View full-size slide

  39. GIT LETS YOU TIME
    TRAVEL
    THING 2:

    View full-size slide

  40. Once you’ve saved some
    snapshots, Git lets you move
    through them
    @alicebartlett

    View full-size slide

  41. Git stores the whole history
    of your project
    @alicebartlett
    20-09-2016: updated link style
    20-05-2016: added changes from monica
    20-06-2016: deleted save icon

    View full-size slide

  42. Each of these commits has an
    id called a hash
    @alicebartlett
    439301fe69e8f875c049ad0718386516b4878e22
    377dfcd00dd057542b112cf13be6cf1380b292ad
    456722223e9f9e0ee0a92917ba80163028d89251

    View full-size slide

  43. @alicebartlett
    I can tell Git what commit I want to check
    out using the commit hash
    d5b87865bc2cd9d38ba8284c2eaa0d0241d800bb
    20-05-2016: deleted play icon

    View full-size slide

  44. Getting the files from a commit
    in the past is known as doing a
    check out
    @alicebartlett

    View full-size slide

  45. @alicebartlett
    I can tell Git what commit I want to check
    out using the commit hash
    d5b87865bc2cd9d38ba8284c2eaa0d0241d800bb
    20-05-2016: deleted play icon

    View full-size slide

  46. @alicebartlett
    I can tell Git what commit I want to check
    out using the commit hash
    d5b87865bc2cd9d38ba8284c2eaa0d0241d800bb
    20-05-2016: deleted play icon

    View full-size slide

  47. @alicebartlett
    My other commits still exist, but when I
    look in my repo, it’s as if they never
    happened
    d5b87865bc2cd9d38ba8284c2eaa0d0241d800bb
    20-05-2016: deleted play icon

    View full-size slide

  48. hash - a computer generated id
    checkout - time travel to a specific commit
    @alicebartlett

    View full-size slide

  49. GIT HELPS YOU
    EXPERIMENT
    THING 3:

    View full-size slide

  50. So far, everything has been
    very linear and ordered.
    @alicebartlett

    View full-size slide

  51. This isn’t really how projects
    work, sometimes you want to
    make easily discardable
    experiments
    @alicebartlett

    View full-size slide

  52. The way you do this in Git is
    with branches
    @alicebartlett

    View full-size slide

  53. A branch is a moveable label
    attached to a commit
    @alicebartlett

    View full-size slide

  54. @alicebartlett
    master
    The default branch name in Git
    is master

    View full-size slide

  55. @alicebartlett
    add-new-styles
    You can add your own
    branches too
    master

    View full-size slide

  56. @alicebartlett
    add-new-styles
    A developer will often do lots
    of work on a branch
    master

    View full-size slide

  57. @alicebartlett
    add-new-styles
    wild-experiment
    master

    View full-size slide

  58. Branches are useful for trying
    out stuff, as they’re really easy
    to throw away if you decide you
    don’t like your changes
    @alicebartlett

    View full-size slide

  59. At the FT most dev work is
    done in branches, the master
    branch is considered special
    @alicebartlett

    View full-size slide

  60. It’s common for the master
    branch to be the version of the
    code or files that are live on the
    site
    @alicebartlett

    View full-size slide

  61. Whereas other branches can
    contain work in progress
    @alicebartlett

    View full-size slide

  62. Once you’re happy with some
    work, you need a way to get it
    back into master
    @alicebartlett

    View full-size slide

  63. @alicebartlett
    add-new-styles
    To get changes from one branch
    into another, you merge them
    master

    View full-size slide

  64. @alicebartlett
    add-new-styles
    master
    So this commit, is a
    combination of all
    of the commits
    from both branches

    View full-size slide

  65. branch - a moveable label that points to a commit
    merge - the combination of two or more branches
    @alicebartlett

    View full-size slide

  66. GIT HELPS YOU BACK
    UP YOUR WORK
    THING 4:

    View full-size slide

  67. Everyone knows that you should
    back up your work regularly
    @alicebartlett

    View full-size slide

  68. Ideally to somewhere that is
    geographically distinct from your
    computer
    @alicebartlett

    View full-size slide

  69. @alicebartlett
    logo.svg
    logo-2.svg
    logo-3-monica-feedback.svg
    logo-3-FINAL.svg
    logo-3-FINAL-1.svg

    View full-size slide

  70. - Safer
    - Access from different places
    - Shared access
    @alicebartlett

    View full-size slide

  71. In Git this place is called a remote
    @alicebartlett

    View full-size slide

  72. A very popular remote is Github
    @alicebartlett

    View full-size slide

  73. To get some work from a remote
    for the first time you clone it
    @alicebartlett

    View full-size slide

  74. @alicebartlett
    Remote

    View full-size slide

  75. @alicebartlett
    Remote
    clone

    View full-size slide

  76. Remote
    @alicebartlett
    clone

    View full-size slide

  77. Remote
    @alicebartlett
    Now everyone
    has the repo on
    their computer

    View full-size slide

  78. Remote
    @alicebartlett
    Lucy Kellaway
    10:34am November 4th 2016
    Fix broken icon tinting
    Icon tinting was case sensitive so #FFF
    worked but #fff didn’t. This commit
    removes this bug.

    View full-size slide

  79. Remote
    @alicebartlett

    View full-size slide

  80. @alicebartlett
    Remote
    Lucy can send
    her changes to
    remote

    View full-size slide

  81. @alicebartlett
    push!
    Remote

    View full-size slide

  82. Remote
    @alicebartlett
    This is known as
    a push

    View full-size slide

  83. @alicebartlett
    Now Martin is
    behind
    Remote

    View full-size slide

  84. @alicebartlett
    To get these
    changes, Martin will
    need to pull them
    Remote

    View full-size slide

  85. @alicebartlett
    pull!
    Remote

    View full-size slide

  86. remote - a computer with a repo on it
    clone - get the repo from the remote for the first time
    pull - get new commits to the repo from the remote
    push - send your new commits to the remote
    @alicebartlett

    View full-size slide

  87. GIT HELPS YOU
    COLLABORATE
    THING 5:

    View full-size slide

  88. @alicebartlett
    Committing helps you tell other
    people the story of your project

    View full-size slide

  89. @alicebartlett
    Remotes mean other people can
    access your project

    View full-size slide

  90. @alicebartlett
    Merges help manage combining
    your work with someone else’s

    View full-size slide

  91. @alicebartlett
    Git allows lots of people to work
    on the same project, which is why
    people suffer through the terrible
    UX of it.

    View full-size slide

  92. @alicebartlett
    repository
    commit
    hash
    checkout
    branch
    merge
    remote
    clone
    push
    pull
    Git terms we’ve covered
    your project folder
    a snapshot of your repo
    an id for a commit
    time travel to a specific commit
    a movable label that points to a commit
    combining two branches
    a computer with the repository on it
    get the repository from the remote for the first time
    send commits to a remote
    get commits from a remote

    View full-size slide

  93. 1. Tell the story of your project
    2. Travel back in time
    3. Experiment with changes
    4. Back up your work
    5. Collaborate on projects

    View full-size slide

  94. Alice Bartlett
    Senior Developer, Financial Times
    @alicebartlett
    Thank you

    View full-size slide