Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Contribution for beginners #3604

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added docs/img/beginner_contribution_clone_repo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/beginner_contribution_fork_repo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/beginner_contribution_make_pr.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
245 changes: 245 additions & 0 deletions docs/the-contribution-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
## Contributing to Exercism

Open source contributions can be intimidating! As you're looking around, wondering where to dive in, you might think everyone _else_ knows what's going on in the code base, or has better grasp of the language, or seems to be well known around the project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this opening. It hits people right where they might be hurting.


As a total beginner, where do you begin?

Right here. This guide will walk you through your first open source contribution.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is a great continuation of that opening. It's super welcoming and friendly.


It's going to target the smallest possible fix (improving documentation), as a "bridge" to more complex contributions later.

First, go take a look at [Contributing to Exercism.io](https://github.com/exercism/exercism.io/blob/master/CONTRIBUTING.md#submitting-code-changes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've been slowly moving all of our project-wide documentation into the http://github.com/exercism/docs repository. It is still a bit of a mess, but there's a lot of good content, and some of it is even organized fairly well.

I'd love to have this basic guide be about contributing to Exercism as a whole, and maybe use one of the language track repositories as the example instead of the main website repository (long story, but we're doing a ginormous rewrite/redesign, and the website repo is going to go away sometime in the next couple of months).

If we go down the route of having the guide be about the language tracks, then I think maybe we could link to https://github.com/exercism/docs/tree/master/contributing-to-language-tracks instead of the site contributing guide. Or there might be another document that is better, but I think the contributing to tracks one is a pretty good starting point.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. I'll take a crack at an update later this week. Thanks, @kytrinyx!


If not all of that makes sense to you, keep reading. This is for you.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️



## Table of Contents

- [Find the right contribution](#find-the-right-contribution)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say "Finding" here to match format of all the other bullet points.

- [Claiming that contribution](#claiming-that-contribution)
- [Working on the code](#working-on-the-code)
- [Submitting your contribution](#submitting-your-contribution)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout the guide, it might make sense to point to other documents in the docs repo, as "deep dives" on a subject.


# Find the right contribution

As mentioned in the contribution guideline, take a look at the [open issues](https://github.com/exercism/exercism.io/issues). There's a lot here, so you might want to filter by `label:"good first patch"` [(like this)](https://github.com/exercism/exercism.io/labels/good%20first%20patch).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This label helped me find a suitable issue to work on. Not sure about the link to exercism.io repo after reading #r130772596.
Maybe it should lead to problem-specifications as it has more issues to work on at the moment

Correct me if I misunderstood something

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would link to the good first patch label on the exercism org in general here:

https://github.com/search?utf8=%E2%9C%93&q=org%3Aexercism+is%3Aissue+is%3Aopen+label%3A%22good+first+patch%22&type=


Read through the conversations, and decide if it seems like a good fit.

(Another good place to start: [Finding your way](https://github.com/exercism/docs/blob/master/finding-your-way.md))

As an example, I (person who is writing this guide) went through the above steps and found [this conversation](https://github.com/exercism/exercism.io/issues/3252). I thought "I think I can do that", and decided I wanted to.

# Claiming that contribution

Why would you claim an issue?

It will make sure that you're not duplicating someone else's work, or someone else doesn't start duplicating yours. It also helps the project maintainers know what is being worked on. It's hard to over communicate, so you should certainly claim an issue.

Different projects have different ways of "claiming" an issue, but for Exercism, just drop a comment in there, [like so](https://github.com/exercism/exercism.io/issues/3252#issuecomment-312428804).

If it makes sense, someone from the project will jump in, offer some guidance, and (generally) be pleased with your offer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So true.


# Working on the code

OK, you've got an issue, you've got approval to work on it. Now's the fun part.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that you totally don't need approval. In fact... it's such a huge relief when people jump in and get started (even just a little bit) without asking for approval.

The only caveat is that there's a ton of issues that go stale and the maintainers sometimes lose track of what's open, and then a bunch of stuff turns out to be out of date. So as part of claiming, I would totally recommend asking if the issue is still relevant. If it is you'll get a quick thumbs up, and if not, the maintainers will generally add more context.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My favorite phrase is

Unless I hear differently...

source

A comment to the tune of

Unless I hear differently, I'll start working on this issue...

Would be perfect. I'll update this to a "forgiveness, not permission" workflow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's awesome!


Now you need to get Exercism running on your local machine.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh. OK, so this bit is going to change a LOT and I have no idea what it's going to look like yet, unfortunately. I'll know more in a few weeks. If we go with a "tracks" guide, then that's easier to define now (go look at their readme, and if they have one, the contributing guide, for how to get the exercises running locally).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. I'll drop a note to this extent in the guide, and even add something like

by the time you read this, the setup steps might have changed quite a bit. Exercism is in the middle of some huge updates. If this guide seems out of date, and you've read this far, perhaps updating this out-of-date section of the guide could be your first contribution

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💖 that's perfect

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe Docker can do that (setting a local development environment) without pain


Setup can be challenging, but fortunately, Exercism has great docs for [walking you through this process](https://github.com/exercism/exercism.io/blob/master/docs/setting-up-local-development.md).

If you can work through the steps in the above guide, great! If you're still not positive what to do, read on.

1. Fork the Exercism repository to your github account.

The URL for the repo looks like https://github.com/exercism/exercism.io

You want it to be https://github.com/YOUR-USERNAME-HERE/exercism.io

"[Forking](https://help.github.com/articles/fork-a-repo/)" is how we do that.



![Forking the Repo](/docs/img/beginner_contribution_fork_repo.gif)

Go to https://github.com/exercism/exercism.io, and click "Fork". When it asks "Where should we fork this repository", choose your user account.

2. Clone down the forked repo

Now, from the repo in your account (the URL should be something like https://github.com/YOUR-USERNAME-HERE/exercism.io)

Click "clone or download" and get the URL for cloning it.

In your terminal, run

```shell
git clone <url from github here>
```

It might look something like this:

![Cloning down the repo](/docs/img/beginner_contribution_clone_repo.gif)

Once it finishes downloading, change into the new directory, and congrats! You've got Exercism cloned down to your machine!


3. Track the original Exercism repo

As you might expect, the Exercism codebase changes constantly. It's important, therefore, to make sure you can easily stay up-to-date with new changes.

To do that, you have to add the original Exercism repo as one of your remotes.

To show what will happen, fell free to run `git remote -v` in your terminal.

It should show something like this:

```shell
$ git remote -v
origin git@github.com:josh-works/exercism.io.git (fetch)
origin git@github.com:josh-works/exercism.io.git (push)
```

So, we want to add another "remote", pointing to https://github.com/exercism/exercism.io.git

To do that, run:

`git remote add upstream https://github.com/exercism/exercism.io.git`

Now, when you run `git remote -v`, you should have _two_ remotes:

```shell
$ git remote -v

origin git@github.com:josh-works/exercism.io.git (fetch)
origin git@github.com:josh-works/exercism.io.git (push)
upstream https://github.com/exercism/exercism.io.git (fetch)
upstream https://github.com/exercism/exercism.io.git (push)
```

This is perfect. Now, go update your current repo with the 'upstream' repo, just run

```shell
git pull upstream master

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git remote update
git checkout upstream/master -b "my_new_branch_based_on_upstream
_master"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, Docker... can you link me to a Docker guide? I've never actually used it, so it feels like it's more work than just forking/cloning a repo, but that's just my perception.

Right on w/the git commands, too. 👍

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is: Docker and exercism.io (I haven't tried it yet myself).
And I don't think that it's required to cover Docker in this doc, it was just a quick thought.

```

And you'll update your master branch to the most current version from Exercism.


# Working on the code

OK, you've done quite a bit of work to get set up and ready to make your contributions.

Next, you need to check out a new branch, and do the work.

The name of the branch I'm working on right now, as I write this guide, is `contribution_for_beginners`.

You might pick something similarly descriptive of the feature you're working on.

So, with your checked out branch, do your work and make commits as usual. Add files, add descriptive commit messages, etc.



# Submitting your contribution

Once you've made your changes, you are ready to do one of two things:

1. Submit them.
2. Publish them for feedback

The good news is the process for both of these steps is the same.

You're going to make a "pull request", against the Exercism repo.

[Here's a quick explanation/guide for pull requests](https://yangsu.github.io/pull-request-tutorial/), if you want some extra reading.

## Making your pull request

#### Add and commit your code

This is the normal `git add <file>`, `git commit -m "your commit message"` bit.

#### Fetch the current version of exercism, merge it into your branch

Remember that Exercism is a huge codebase and changes regularly. So, you need to make sure that the code your working with is as up-to-date as possible.

```shell
# check out the master branch
$ git checkout master

# get changes to the exercism repo
$ git fetch upstream master

# merge your changes into your master branch
$ git checkout your_working_branch
$ git rebase -i your_working_branch master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of technical, but merging is not rebasing. If you could describe all of this without saying "merge" that would make people who are good at Git twitch a lot less.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof, yeah. I originally described a merge workflow, and then looked at your contribution guidelines, saw "rebase workflow", and forgot to edit the comment on line 172.

Thanks for calling this out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense :-)

```

_git rebase_ is a tricky thing if it's your first time. (I'm still not good at it.)

It's an alternative to _merge_, and though it's a few more steps, its worth it in the long run, as rebasing keeps the commit log much cleaner.

Here's some guides that might help you through:

- [Keeping A GitHub Fork Updated](https://robots.thoughtbot.com/keeping-a-github-fork-updated)
- [Rewriting history](https://www.atlassian.com/git/tutorials/rewriting-history)
- [Merging vs. Rebasing](https://www.atlassian.com/git/tutorials/merging-vs-rebasing)


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe here is a good place to mention Gitter chat since these git magic can be overwhelming for newcomers not familiar with it? Something like this:

Don't forget: If you got stuck or something went wrong you can always ask for help in [our support chat (Gitter)](https://gitter.im/exercism/support)

What do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100% agreed. I'm heading out of town for a few days (leaving in 30 min!) so I'll update and integrate your feedback when I return.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a good weekend!

Often, once you submit your changes, there might be need for additional changes, based on feedback from the project maintainers.

Once you're ready, make the Pull Request


# Making the Pull Request

I *just* made the pull request (PR) for this guide. You can see the PR [here](https://github.com/exercism/exercism.io/pull/3604).

To make the pull request, push your branch up to your forked version of Exercism.

```shell
$ git push origin <branch_name>
```

Then, navigate to your cloned fork of the Exercism repo, and click the "new pull request" button. (You can change all the details of the pull request after clicking this button)

![Make the Pull Request](/docs/img/beginner_contribution_make_pr.gif)

Make sure to select `exercism/exercism.io`, with `master` as the `base fork`, on the left, and `your_username/exercism.io` as the `head fork` on the right. You can choose to compare whichever branch has your changes on it, either `master` or a different branch you worked on.

If you need to collect feedback on your work, it is convention to label your pull request as a "work in progress", or "wip".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks!


The pull request note is your chance to lay out lots of information about what you're doing, why you did it that way, and all relevant details about the code you're adding/changing.

You can "tie" the pull request to the github issue you claimed above with the syntax outlined [here](https://github.com/blog/1506-closing-issues-via-pull-requests)

This links the PR and issue conversation together.

At this point, you can tag anyone in the project to ask for feedback. Just type `@their_user_name` and they'll be notified.

Based on their feedback, you can go back and forth in discussion, and eventually, remove the "wip" tag and merge your contribution!

There is no need to make a new PR or new branches. New commits will automatically get pushed up to the pull request.








### Additional Support

- [A junior developer’s step-by-step guide to contributing to open source for the first time](https://medium.com/@letakeane/contributing-to-open-source-the-sharks-are-photoshopped-47e22db1ab86)




# Notes from Discussion

It would be incredibly helpful if this outline were extracted and written with first-time contributors in mind:

- extract this section into a separate file: docs/the-contribution-workflow.md (please use that name, other work (e.g. #3194) is referencing it).
- elaborate/annotate each action so first-timers can successfully follow the process.
- currently, the flow assumes a contributor knows what "fork", "upstream", "remote", "pull request", "rebase" all mean. Link to existing documentation (ideally documentation that is aimed at first-timers) as much as possible.
- it should be that someone who hasn't contributed on GitHub before can walk through the process and successfully submit a PR, properly.
- encourage readers to go to our support chat room (Gitter) and/or submit an issue to get assistance. We're here to help!!