contributing to open source using git
TRANSCRIPT
Contributing to open source using git
Sameeh Jubran, [email protected]
Open Source
Why contribute to open source?
Why contribute to open source?
● Gain Programming Experience
● Give Back to the Community
● Build a Practical Resume
Overview
Overview
Git repository
MaintainersYou
Open Source project
We did some commits now what?
Now we need to send them to the community
Before sending commits to community
Before sending commits to community
A checklist
● Coding style (tabs vs spaces)● Testing● Clear commit messages
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
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!
Sending commits to community
Two main models
Patches Pull requests
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
Patches
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
Patches● Mainly uses mailing list● Generated using “git format-patch”● Sent using “git send-email”
Patches’ life cycle
Set of commits
Creating a patch/es
Sending to mailing list
Getting reviews
Applying the patches
Patches - mailing list
Mails in the Linux mailing list
6497 messages in one week! (8/11 - 15 /11)
Patches - mailing list
Patches - ExampleWe have this commit
Patches - ExampleCreate a patch out of it
git format-patch
Patches - ExampleThe Patch
Patches - ExampleSending the patch
git send-email
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
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
Pull requests’ life cycle
Set of commits
Pull request
Getting reviews
Pulling the changes
Pull requests
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
Q&A