Your first contribution
Last updated
Everything so far has been in a repository you own. The last step is contributing to one you don't: finding a project that welcomes newcomers, reading its rules, and sending one small, good change. This lesson shows how to choose, what maintainers look for, and, if you don't have a hosting account, how projects like Git itself take changes by email-ready patches.
By the end of this lesson you can
- Find a project and an issue suitable for a first contribution
- Read and follow a project's contributing guide
- Make a small contribution through a fork and a pull request
- Make and apply patches with git format-patch and git am
Choosing a project
A good first contribution is small, in a project that wants newcomers, and something you use or care about. Ways to find one:
- Labels. Many projects mark easy issues
good first issueorhelp wanted. GitHub and GitLab let you search for issues with these labels across all projects (see the sources). Look for an issue nobody has claimed, in a project with recent activity. - Things you use. The app, library or documentation you've noticed a mistake in. A typo, a broken link or an unclear sentence in documentation is a real contribution, and a good first one.
- Signs of a welcoming project: a
CONTRIBUTINGfile, a code of conduct, maintainers who reply politely to other newcomers, and pull requests that get reviewed rather than left for months.
| Good first contributions | Better left for later |
|---|---|
| Fixing a typo or broken link in the docs | Rewriting a module you think is badly designed |
| An issue labelled good first issue, nobody assigned | An issue three people are already discussing fixes for |
| Adding a missing example the issue asks for | A big new feature nobody asked for |
Before you change anything
- Read the CONTRIBUTING file (lesson 5.5). It says how to set up, how to name branches, what commit messages look like, whether you need to sign off your commits (
git commit -s, lesson 7.2), and how to run the checks. - Read the issue and its comments. If it isn't clear, or you want to be sure nobody's on it, comment first: "I'd like to work on this. I'm planning to … Does that sound right?" Some projects assign the issue to you.
- Look at a few merged pull requests, to see the size and style that get accepted.
Make the contribution
The fork workflow from lesson 5.5, for real:
(fork the project on the host, then:) git clone https://example.com/you/their-project.git cd their-project git remote add upstream https://example.com/them/their-project.git git switch -c fix-broken-link (make the change, run the project’s checks) git commit -s -m "docs: fix the broken link to the install guide" git push -u origin fix-broken-link
Then open a pull request from your fork's branch into their main. In the description, say what you changed and why, link the issue ("Fixes #123" closes it on merge on most hosts), and say how you checked it.
Keep it to the one change. If you noticed other things, they're separate issues or pull requests.
No account? Contribute by patch
Some projects, including Git and the Linux kernel, take changes as patches by email rather than pull requests. It also works between two clones with no host at all, so you can practise it with Kusina right now.
As Carla, make a small fix on a branch, then turn the commit into a patch file:
cd ~/carla-kusina git switch -c fix-tinola (make a small fix in tinola.md) git commit -s -am "fix: name the leaves you can use in tinola" git format-patch main -o ~/patches /home/ana/patches/0001-fix-name-the-leaves-you-can-use-in-tinola.patch
The patch file holds the author, date, message and diff: everything needed to make the same commit elsewhere. As Ana, apply it:
cd ~/ana-kusina git switch main git am ~/patches/0001-fix-name-the-leaves-you-can-use-in-tinola.patch Applying: fix: name the leaves you can use in tinola git log -1 --format="%an: %s" Carla Reyes: fix: name the leaves you can use in tinola
The commit keeps Carla as its author, and Ana as its committer. That's how Git's own history records who wrote a change and who applied it. Projects that work this way send patches with git send-email to a mailing list; their SubmittingPatches or CONTRIBUTING guide says how.
After you send it
Ana’s first pull request gets a review: “Thanks! Could you also update the link in the README, and squash the two commits?” She feels told off.
What happens if…
- Be patient. Maintainers are often volunteers; a week without a reply is normal. A polite nudge after a couple of weeks is fine.
- If it isn't merged, you've still learned the project, and the next one is easier.
- When it is merged: update your fork's main from upstream (lesson 5.5), delete your branch, and find the next one.
Check what you learned
Sources
Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.
- GitHub Docs: Finding ways to contribute to open source on GitHub: good first issue labels, and searching for them
- GitHub Docs: Setting guidelines for repository contributors: what CONTRIBUTING files hold
- GitHub Docs: About forks
- Pro Git: Contributing to a Project: forks, pull requests and patches by email
- Git documentation: git-format-patch
- Git documentation: git-am
- Git documentation: SubmittingPatches: how the Git project itself takes contributions