Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

DISCLAIMER: I am not working at GitHub.

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

dž

Slide 5

Slide 5 text

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)

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

GIT FOR NEWCOMERS Å try.github.io

Slide 8

Slide 8 text

® GITHUB

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

SOCIAL CODING

Slide 12

Slide 12 text

INTEGRATED ISSUE TRACKING

Slide 13

Slide 13 text

INTEGRATED ISSUE TRACKING

Slide 14

Slide 14 text

SYNTAX HIGHLIGHTING

Slide 15

Slide 15 text

COLLABORATIVE CODE REVIEW

Slide 16

Slide 16 text

COLLABORATIVE CODE REVIEW

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

COMPARE VIEW

Slide 19

Slide 19 text

RELEASE MANAGEMENT

Slide 20

Slide 20 text

TEAM MANAGEMENT

Slide 21

Slide 21 text

OUTSIDE COLLABORATORS

Slide 22

Slide 22 text

PER PROJECT COLLABORATORS

Slide 23

Slide 23 text

PROTECTED BRANCHES

Slide 24

Slide 24 text

DEPLOYMENT MANAGEMENT

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

GITLAB (quickly)

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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.

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

WORKFLOWS a.k.a. collaboration patterns

Slide 32

Slide 32 text

CENTRALIZED Shared repository (subversion-style)

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

DICTATOR AND LIEUTENANTS Blessed repository + trusted lieutenants and a dictator

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

GITHUB FLOW Å Understanding the GitHub Flow

Slide 37

Slide 37 text

GITLAB FLOW Å GitLab Flow

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

OPEN SOURCE

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

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

Slide 42

Slide 42 text

HOW TO CONTRIBUTE?

Slide 43

Slide 43 text

Everyone can contribute.

Slide 44

Slide 44 text

FORK THE REPOSITORY

Slide 45

Slide 45 text

CREATE A BRANCH git checkout -b feature-branch

Slide 46

Slide 46 text

EAT, SLEEP, CODE, REPEAT.

Slide 47

Slide 47 text

SUBMIT A PULL REQUEST But, how?

Slide 48

Slide 48 text

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

Slide 49

Slide 49 text

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

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

(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!

Slide 52

Slide 52 text

REBASE YOUR BRANCH

Slide 53

Slide 53 text

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

Slide 54

Slide 54 text

PUSH & CREATE

Slide 55

Slide 55 text

PROFIT!

Slide 56

Slide 56 text

WHAT HAPPENS THEN?

Slide 57

Slide 57 text

An Open Source maintainer will look at your work.

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

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/

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

HOW TO OPEN SOURCE?

Slide 62

Slide 62 text

LICENSE

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

Å TLDRLEGAL.COM

Slide 65

Slide 65 text

Å CHOOSEALICENSE.COM

Slide 66

Slide 66 text

THE README FILE

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

## 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

Slide 69

Slide 69 text

THE CONTRIBUTING FILE

Slide 70

Slide 70 text

Also, checkout ! Atom's one

Slide 71

Slide 71 text

THE CODE_OF_CONDUCT FILE

Slide 72

Slide 72 text

Å CONTRIBUTOR-COVENANT.ORG

Slide 73

Slide 73 text

WRITE TESTS & AUTOMATE

Slide 74

Slide 74 text

BE STANDARD

Slide 75

Slide 75 text

ATTITUDE

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

COMMUNICATION IS KEY!

Slide 78

Slide 78 text

HIRE PEOPLE

Slide 79

Slide 79 text

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

Slide 80

Slide 80 text

ONE MORE THING

Slide 81

Slide 81 text

Open Source is more than making code available for free.

Slide 82

Slide 82 text

It is a lot of work!

Slide 83

Slide 83 text

Care about the people first.

Slide 84

Slide 84 text

Communication is essential!

Slide 85

Slide 85 text

Everyone can contribute! Å Your First PR

Slide 86

Slide 86 text

Open Source is more than downloading code available for free.

Slide 87

Slide 87 text

Give, don't (only) take.

Slide 88

Slide 88 text

There are people behind Open Source projects.

Slide 89

Slide 89 text

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

Slide 90

Slide 90 text

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

Slide 91

Slide 91 text

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

Slide 92

Slide 92 text

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