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

Git & Open Source & Collaboration

Git & Open Source & Collaboration

Talk on Git, Open Source, and collaborative patterns (a.k.a. workflows). This is a short-version of my "Git & GitHub & Open Source" talk I gave at LavaJUG: https://speakerdeck.com/willdurand/2015.

William Durand

January 28, 2016
Tweet

More Decks by William Durand

Other Decks in Programming

Transcript

  1. GIT & OPEN SOURCE
    & COLLABORATION
    William Durand - January 28th, 2016 @ Michelin

    View full-size slide

  2. DISCLAIMER: I am not working at GitHub.

    View full-size slide

  3. "MACRO" AGENDA
    1. Git
    2. Git(Hub|Lab)
    3. Workflows
    4. Open Source

    View full-size slide

  4. Git is a widely used version control system for software
    development. It is a distributed revision control system.
    Å https://en.wikipedia.org/wiki/Git_(software)

    View full-size slide

  5. Credit: https://aht.github.io/whatisgit/

    View full-size slide

  6. GIT FOR NEWCOMERS
    Å try.github.io

    View full-size slide

  7. GitHub is the largest code host on the planet
    with over
    29.5 million
    repositories.

    View full-size slide

  8. SOCIAL CODING

    View full-size slide

  9. INTEGRATED ISSUE TRACKING

    View full-size slide

  10. INTEGRATED ISSUE TRACKING

    View full-size slide

  11. SYNTAX HIGHLIGHTING

    View full-size slide

  12. COLLABORATIVE CODE REVIEW

    View full-size slide

  13. COLLABORATIVE CODE REVIEW

    View full-size slide

  14. PULL REQUEST (PR)
    Pull Request = Code + Issue + Code Comments

    View full-size slide

  15. COMPARE VIEW

    View full-size slide

  16. RELEASE MANAGEMENT

    View full-size slide

  17. TEAM MANAGEMENT

    View full-size slide

  18. OUTSIDE COLLABORATORS

    View full-size slide

  19. PER PROJECT COLLABORATORS

    View full-size slide

  20. PROTECTED BRANCHES

    View full-size slide

  21. DEPLOYMENT MANAGEMENT

    View full-size slide

  22. HUB
    git + hub = github \o/
    Å hub.github.com

    View full-size slide

  23. GITLAB
    (quickly)

    View full-size slide

  24. GitLab is an
    Open Source
    (MIT licensed) web-based Git
    repository manager with wiki and issue tracking features.

    View full-size slide

  25. GitLab started a side project in 2011.
    In 2015, more than 800 (worldwide) contributors, 10+
    employees, and 1.5M raised in seed funding in July.

    View full-size slide

  26. GETTING STARTED
    On your
    In your company
    gitlab.com
    git.framasoft.org
    Raspberry Pi
    Pro-tip:
    Merge Request ≈ Pull Request

    View full-size slide

  27. WORKFLOWS
    a.k.a. collaboration patterns

    View full-size slide

  28. CENTRALIZED
    Shared repository (subversion-style)

    View full-size slide

  29. RELEASE (OR INTEGRATION) MANAGER
    Blessed repository + a release manager

    View full-size slide

  30. DICTATOR AND LIEUTENANTS
    Blessed repository + trusted lieutenants and a dictator

    View full-size slide

  31. GIT FLOW
    " "
    A successful Git branching model
    Well... Maybe not. See
    instead.
    this simple
    git branching model

    View full-size slide

  32. GITHUB FLOW
    Å
    Understanding the GitHub Flow

    View full-size slide

  33. GITLAB FLOW
    Å GitLab Flow

    View full-size slide

  34. POUCE DRIVEN DEVELOPMENT
    › + › = Good to merge/ship

    View full-size slide

  35. In production and development, Open Source as a
    development model promotes a
    universal access
    via a
    free license
    to a product's design or blueprint [...].
    Å
    http://en.wikipedia.org/wiki/Open_source

    View full-size slide

  36. Open-source software is very often developed
    in a
    public
    ,
    collaborative
    manner.

    View full-size slide

  37. HOW TO CONTRIBUTE?

    View full-size slide

  38. Everyone can contribute.

    View full-size slide

  39. FORK THE REPOSITORY

    View full-size slide

  40. CREATE A BRANCH
    git checkout -b feature-branch

    View full-size slide

  41. EAT, SLEEP, CODE, REPEAT.

    View full-size slide

  42. SUBMIT A PULL REQUEST
    But, how?

    View full-size slide

  43. LOOK AT THE CONTRIBUTING FILE
    (If it does not exist, contribute by adding it!)

    View full-size slide

  44. WRITE GOOD COMMIT MESSAGES
    Capitalized, short (50 chars or less) summary
    More detailed explanatory text, if necessary. Wrap it to about 72
    characters or so. In some contexts, the first line is treated as the
    subject of an email and the rest of the text as the body. The blank
    line separating the summary from the body is critical (unless you omit
    the body entirely); tools like rebase can get confused if you run the
    two together.
    Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
    or "Fixes bug." This convention matches up with commit messages generated
    by commands like git merge and git revert.
    Further paragraphs come after blank lines.
    Å A Note About Git Commit Messages

    View full-size slide

  45. FIRST LINE ≤ 50 CHARS, PRESENT IMPERATIVE
    "Subject of an email"
    Emojis all the things! (like )
    Atom

    View full-size slide

  46. (Blank line before details)
    DETAILS LINES ≤ 72 CHARS: EXPLAIN WHAT YOU DID
    "Body of an email"
    (GFM):
    G
    itHub
    F
    lavored
    M
    arkdown
    Italics, bold
    URL autolinking
    Syntax highlighting
    Auto-close issues
    : Fix #123
    and more!

    View full-size slide

  47. REBASE YOUR BRANCH

    View full-size slide

  48. SQUASH YOUR COMMITS
    git rebase -i HEAD~2
    pick 5335450 add test
    pick 4c20f8d Fix undefined variable
    # Rebase 35124cb..4c20f8d onto 35124cb
    #
    # Commands:
    # p, pick = use commit
    # r, reword = use commit, but edit the commit message
    # e, edit = use commit, but stop for amending
    # s, squash = use commit, but meld into previous commit
    # f, fixup = like "squash", but discard this commit's log message
    # x, exec = run command (the rest of the line) using shell
    #
    # These lines can be re-ordered; they are executed from top to bottom.
    #
    # If you remove a line here THAT COMMIT WILL BE LOST.
    #
    # However, if you remove everything, the rebase will be aborted.
    #
    # Note that empty commits are commented out
    Å Squashing commits with rebase

    View full-size slide

  49. PUSH & CREATE

    View full-size slide

  50. WHAT HAPPENS THEN?

    View full-size slide

  51. An Open Source
    maintainer
    will look at your work.

    View full-size slide

  52. PULL REQUEST REVIEW
    Understand the goal of the PR
    Try to reproduce the issue
    Try the fix
    Test the new feature
    Think about edge cases
    Write documentation if not provided

    View full-size slide

  53. WHAT KEY CHALLENGES DO
    INTEGRATORS FACE WHEN WORKING
    WITH PULL REQUESTS?
    Å
    http://www.gousios.gr/blog/How-do-project-owners-use-pull-requests-on-Github/

    View full-size slide

  54. HOW TO OPEN SOURCE?

    View full-size slide

  55. NO LICENSE ==
    ALL RIGHTS RESERVED ©
    Å https://github.com/blog/1964-license-usage-on-github-com

    View full-size slide

  56. Å TLDRLEGAL.COM

    View full-size slide

  57. Å CHOOSEALICENSE.COM

    View full-size slide

  58. THE README FILE

    View full-size slide

  59. project-x
    =========
    project-x is a better way to achieve this and that, by leveraging the new
    API, bla bla bla.
    ## Usage
    ...
    ## Installation
    ...
    ## Requirements
    ...
    ## Contributing
    See CONTRIBUTING file.
    README example 1/2

    View full-size slide

  60. ## Running the Tests
    ...
    ## Credits
    ...
    ## Contributor Code of Conduct
    Please note that this project is released with a [Contributor Code of
    Conduct](http://contributor-covenant.org/). By participating in this project
    you agree to abide by its terms. See CODE_OF_CONDUCT file.
    ## License
    project-x is released under the MIT License. See the bundled LICENSE file for
    details.
    README example 2/2

    View full-size slide

  61. THE CONTRIBUTING FILE

    View full-size slide

  62. Also, checkout !
    Atom's one

    View full-size slide

  63. THE CODE_OF_CONDUCT FILE

    View full-size slide

  64. Å CONTRIBUTOR-COVENANT.ORG

    View full-size slide

  65. WRITE TESTS & AUTOMATE

    View full-size slide

  66. COMMUNICATION IS KEY!

    View full-size slide

  67. All of this can be applied to your "internal" projects too ė

    View full-size slide

  68. ONE MORE THING

    View full-size slide

  69. Open Source is more than
    making code available for free.

    View full-size slide

  70. It is a lot of work!

    View full-size slide

  71. Care about the people first.

    View full-size slide

  72. Communication is essential!

    View full-size slide

  73. Everyone can contribute!
    Å Your First PR

    View full-size slide

  74. Open Source is more than
    downloading code available for free.

    View full-size slide

  75. Give, don't (only) take.

    View full-size slide

  76. There are people behind Open Source projects.

    View full-size slide

  77. Money is still an issue in OSS...
    Å
    https://coderanger.net/funding-foss/

    View full-size slide

  78. ...which is not the case in a company.

    View full-size slide

  79. THANK YOU.
    QUESTIONS?
    ¾
    ®
    ¬
    Â
    williamdurand.fr
    github.com/willdurand
    twitter.com/couac
    TailorDev SAS

    View full-size slide

  80. LINKS
    http://williamdurand.fr/2013/07/04/on-open-sourcing-libraries/
    http://williamdurand.fr/2013/11/20/on-creating-pull-requests/
    http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
    http://git-scm.com/book/en/v2/Git-Branching-Rebasing
    http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
    https://github.com/blog/1530-choosing-an-open-source-license
    https://help.github.com/articles/open-source-licensing/
    http://www.codinghorror.com/blog/2007/04/pick-a-license-any-license.html
    https://medium.com/code-zen/how-to-maintain-a-successful-open-source-project-
    aaa2a5437d3a
    http://ryanbigg.com/2015/11/open-source-work/
    https://robots.thoughtbot.com/git-bisect
    https://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git
    https://git-scm.com/docs/git-archive
    http://writing.jan.io/2015/11/20/sustainable-open-source.html

    View full-size slide