Skip to content

Instantly share code, notes, and snippets.

@devinschumacher
Created September 15, 2024 22:04
Show Gist options
  • Save devinschumacher/ff95837113d9a9a38ac76128b47ad943 to your computer and use it in GitHub Desktop.
Save devinschumacher/ff95837113d9a9a38ac76128b47ad943 to your computer and use it in GitHub Desktop.
How to make an open source contribution, step-by-step (with a real life example)
title tags
How to Make an Open Source Contribution, a step-by-step Walkthrough
open-source
git
github
programming

Example: Making an open source contribution to drizzle-team/drizzle-orm-docs

How to Make an Open Source Contribution Steps

  1. Fork the repository you want to contribute to
  2. Clone the fork to your local machine
  3. Create a new topic branch to work on
  4. Make your changes to the project
  5. Inspect, stage, and commit the changes if all is good
  6. Push your branch/changes to your remote fork
  7. Open a pull request from your fork/branch to the original repository

Step by step walkthrough

1. Fork the drizzle-team/drizzle-orm-docs repository

# gh repo fork <org>/<repo>
$ gh repo fork drizzle-team/drizzle-orm-docs
# gh repo fork <org>/<repo>
$ gh repo fork drizzle-team/drizzle-orm-docs

2. Clone the fork to your local machine

# gh repo clone <your-username>/<repo>
$ gh repo clone devinschumacher/drizzle-orm-docs

$ cd drizzle-orm-docs

3. Create a new branch for the project and open it up

# git checkout -b <branch-name>
$ git checkout -b fix-typo
$ code .

4. Make your changes to the project

- `drizzle-kit generate` lets you generate migrations based on you Drizzle schema.
+ `drizzle-kit generate` lets you generate migrations based on your Drizzle schema.

5. Inspect, stage, and commit the changes if all is good

$ git status

# output
On branch fix-typo
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   src/content/documentation/kit-docs/commands.mdx
$ git add src/content/documentation/kit-docs/commands.mdx
$ git commit -m "fix: typo in commands.mdx"

6. Push your branch/changes to your remote fork

# git push -u origin <branch-name> OR git push --setup-upstream origin <branch-name>
$ git push -u origin fix-typo

7. Create a pull request from your fork to the original repository

# gh pr create --base main --head <your-username>:<branch-name> --title "Your PR title" --body "Your PR description"
gh pr create --base drizzle-team:main --head devinshcumacher:fix-typo --title "Fix typo in commands.mdx" --body "This PR fixes a typo in the commands documentation."

Or, if you want to use the web interface:

  1. Go to your github fork of the repository > Pull Requests > New Pull Request
  2. Select your branch from the dropdown > Create Pull Request

pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment