contributing to open source using git

30
Contributing to open source using git Sameeh Jubran, [email protected]

Upload: yan-vugenfirer

Post on 08-Feb-2017

70 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Contributing to open source using Git

Contributing to open source using git

Sameeh Jubran, [email protected]

Page 2: Contributing to open source using Git

Open Source

Page 3: Contributing to open source using Git

Why contribute to open source?

Page 4: Contributing to open source using Git

Why contribute to open source?

● Gain Programming Experience

● Give Back to the Community

● Build a Practical Resume

Page 5: Contributing to open source using Git

Overview

Page 6: Contributing to open source using Git

Overview

Git repository

MaintainersYou

Open Source project

Page 7: Contributing to open source using Git

We did some commits now what?

Now we need to send them to the community

Page 8: Contributing to open source using Git

Before sending commits to community

Page 9: Contributing to open source using Git

Before sending commits to community

A checklist

● Coding style (tabs vs spaces)● Testing● Clear commit messages

Page 10: Contributing to open source using Git

Coding style - it is a big deal!

● In many open source projects such as Linux there are scripts that auto check the code and show error messages accordingly

● Code style include:○ Indentation

○ Naming conventions: CamelCase, snake_case, strHungarianNotation ( IsEmpty, is_empty, bIsEmpty)

○ Brackets○ Comments ( /* */ , // )

○ Proper names

● You can find linux’s checkpatch script here:https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl

Page 11: Contributing to open source using Git

Coding style - it is a big deal!

“Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.”

This snippet was taken straight from the Linux kernel Coding style document, it can be found here:

https://www.kernel.org/doc/Documentation/CodingStyle

Please note that at Daynix we prefer spaces!

Page 12: Contributing to open source using Git

Sending commits to community

Page 13: Contributing to open source using Git

Two main models

Patches Pull requests

Page 14: Contributing to open source using Git

Two main models

Patches Pull requests

In both models there is a main repository

In both models there are maintainers which approve/reject changes to the repository

Page 15: Contributing to open source using Git

Patches

Page 16: Contributing to open source using Git

Patches - What are they?● A patch is a small file that indicates what was changed in a repository● Each commit is transformed into one patch using the git format-patch

command

Page 17: Contributing to open source using Git

Patches● Mainly uses mailing list● Generated using “git format-patch”● Sent using “git send-email”

Page 18: Contributing to open source using Git

Patches’ life cycle

Set of commits

Creating a patch/es

Sending to mailing list

Getting reviews

Applying the patches

Page 19: Contributing to open source using Git

Patches - mailing list

Mails in the Linux mailing list

6497 messages in one week! (8/11 - 15 /11)

Page 20: Contributing to open source using Git

Patches - mailing list

Page 21: Contributing to open source using Git

Patches - ExampleWe have this commit

Page 22: Contributing to open source using Git

Patches - ExampleCreate a patch out of it

git format-patch

Page 23: Contributing to open source using Git

Patches - ExampleThe Patch

Page 24: Contributing to open source using Git

Patches - ExampleSending the patch

git send-email

Page 25: Contributing to open source using Git

Pull requests - What are they?

● let you tell others about changes you've pushed to a GitHub repository. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary

● When you file a pull request, all you’re doing is requesting that another developer (the project maintainer) pulls a branch from your repository into their repository

Page 26: Contributing to open source using Git

Pull requests● The repository needs to be accessible ( Can be a downside )● Generated and sent using “git request-pull”● Github ( and other similar websites) mainly uses this methodology

Page 27: Contributing to open source using Git

Pull requests’ life cycle

Set of commits

Pull request

Getting reviews

Pulling the changes

Page 28: Contributing to open source using Git

Pull requests

Page 29: Contributing to open source using Git

Summary

Patches

● Mainly uses mailing list● Generated using “git

format-patch”● Sent using “git send-email”

Pull requests

● The repository needs to be accessible

● Generated and sent using “request-pull”

● Github mainly uses this methodology

Page 30: Contributing to open source using Git

Q&A