Slide 1

Slide 1 text

A Noob’s Intro to using Git for Open Source SUBHRAJYOTI SEN

Slide 2

Slide 2 text

Who Am I? Subhrajyoti Sen • Open Source Enthusiast • Mozillian • Android Developer • Net Neutrality and Privacy advocate

Slide 3

Slide 3 text

What is Open Source The term "open source" refers to something people can modify and share because its design is publicly accessible.

Slide 4

Slide 4 text

Some Famous Open Source Projects

Slide 5

Slide 5 text

Why Contribute to Open Source • Amazing Learning Opportunities • Amazing Communities • Big Plus on CV • You can go places. Literally • You get direct credits

Slide 6

Slide 6 text

Contribution Guidelines source: youtube-dl For the repository owner, contribution guidelines are a way to communicate how people should contribute. For contributors, the guidelines help them verify that they're submitting well-formed pull requests and opening useful issues. - GitHub

Slide 7

Slide 7 text

Writing Proper Commit Messages • No swear words • Get straight to the point • Proper references • Write messages that you can understand a year down the line • Commit message length can vary from two sentences to multiple paragraphs

Slide 8

Slide 8 text

Writing Proper Commit Messages

Slide 9

Slide 9 text

Maintaining Authorship • The person making the changes in the commit is the author • It’s always OK to use someone's commit in your project but with authorship • It’s NOT OK to change authorship of a commit git commit --amend --author="Name "

Slide 10

Slide 10 text

Cherry Picking • Apply an existing commit to your project • The part modified by the commit should have a similar structure to the existing project • Automatically maintains authorship • Used extensively in Linux kernel and AOSP development

Slide 11

Slide 11 text

Cherry Picking – How? Cherry-pick is 2-step process 1. Fetching • git fetch remote branch 2. Cherry Picking • git cherry-pick

Slide 12

Slide 12 text

Hard Reset • Rewrite commit history • Useful for “remove password” situation • Needs a force push git reset --hard

Slide 13

Slide 13 text

Force pushing • With great power comes great responsibility • When in doubt, use it with supervision • Never do it in production code git push –f remote branch

Slide 14

Slide 14 text

Squashing • Combine multiple commits into a single commit • Better readability of commit history • Always suggested while making a PR for a single issue git reset --soft HEAD~X git commit –m “New commit message”

Slide 15

Slide 15 text

Pull Request 1. Fork 2. Clone 3. Commit 4. Push 5. Make Pull Request 6. Repeat

Slide 16

Slide 16 text

Merge Conflicts Sometimes there are competing changes that Git needs your help with to decide which changes to incorporate in the final merge. Often, merge conflicts happen when people make different changes to the same line of the same file, or when one person edits a file and another person deletes the same file.

Slide 17

Slide 17 text

Rebasing Useful when to update a fork 1. git checkout target-branch 2. git pull upstream target-branch 3. git checkout victim-branch 4. git rebase target-branch 5. git push –f origin victim-branch

Slide 18

Slide 18 text

How to Find your First Bug Some amazing resources to find your first bug to solve • http://up-for-grabs.net • http://issuehub.io • GitHub Search: easy, low hanging fruit, beginner • @first_tmrs_only

Slide 19

Slide 19 text

THANK YOU @iamsubhrajyoti @SubhrajyotiSen