Sub topic 2
Before You Start: Read the Contribution Guidelines
This chapter assumes you have a GitHub account, Git installed with your name and email configured, and basic familiarity with add, commit, status, and log in a terminal. You have not forked anything yet. First you need to check that the project wants the change you plan to make.
Why guidelines come first
A fork gives you a private copy to work in, but the maintainers decide what gets merged into the original repository. Each project has its own rules about code style, tests, commit messages, and how to propose changes. A pull request that ignores those rules is often closed or sent back, even when the code is correct.
Reading the guidelines before you write code saves you from redoing work. It also shows maintainers that you respect their time.
Where to look
Maintainers usually put project rules in a few standard files at the top of the repository. Check them in this order.
| File | What it tells you |
|---|---|
| `README.md` | What the project does, how to install it, how to run it |
| `CONTRIBUTING.md` | How to propose changes, branch naming, commit style, test requirements |
| `CODE_OF_CONDUCT.md` | Expected behavior in issues, reviews, and discussions |
| `.github/PULL_REQUEST_TEMPLATE.md` | The form your pull request description should follow |
| `.github/ISSUE_TEMPLATE/` | The forms for reporting bugs or requesting features |
| `LICENSE` | The terms under which your contribution is accepted |
CONTRIBUTING.md can also live in a docs/ or .github/ folder. GitHub links to it from the "New pull request" and "New issue" pages when it exists.
What to extract from them
While you read, write down the answers to these questions:
- Which branch should pull requests target? Most projects use
main, but some usedevelopor a release branch. - Do you need to open an issue and get agreement before you start?
- How do you run the tests and the linter locally?
- Is there a required commit message format, such as Conventional Commits?
- Does the project require a sign-off (
git commit -s) or a contributor license agreement?
git log --oneline -10The recent history shows the commit message style the maintainers actually use. This is useful when the written guidelines are short or missing.
Find a suitable issue
The easiest first contribution is an existing issue that maintainers have already accepted. Open the repository's Issues tab and filter by labels. Common labels for newcomers include good first issue, help wanted, and documentation.
Before you pick an issue, check three things:
- The issue is still open and no one is assigned to it.
- No open pull request already links to it. Linked pull requests appear in the issue's sidebar and timeline.
- The scope is small enough to finish in one focused pull request.
Then leave a short comment, for example: "I'd like to work on this. I plan to fix it by updating the install section of the README. Is that the right approach?" This claims the work and lets maintainers correct your plan before you start.
Exercise
You find a good first issue that you want to fix. Name three things to check before you comment on it, and one file in the repository that tells you how to format your pull request description.
Show answer
Check that the issue is open, that nobody is assigned to it, and that no open pull request already links to it. Also confirm the scope is small. The pull request description format is defined in .github/PULL_REQUEST_TEMPLATE.md, and CONTRIBUTING.md may add further rules.