Hello 👋 This document is a guide to both onboard new contributors in contributing to our repositories and hub-docs repository in general. Thanks a lot for considering to contribute! 🤗

(if this is a code PR, if not, skip these two steps!) Firstly, please give a read to the contribution guidelines. It will save both your and maintainers’ time, you will get to learn about developer setup, style guide and more!

Untitled

Untitled

Before solving something that you think is missing/broken, make sure to open an issue and discuss with core maintainers 🙂 if you see the issue exists, make sure you discuss with core maintainers about design decisions (especially if it's a big thing to solve!)

Untitled

If it’s a documentation PR you’re opening and it’s your first time contributing to an open-source project, read below 👇🏼

Ping the maintainers in the issue saying you are interested in contributing to a project.

Ekran Resmi 2022-10-04 21.44.17.png

To get started with writing code:

  1. Fork the repository. A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project. (see more here: https://docs.github.com/en/get-started/quickstart/fork-a-repo)

Ekran Resmi 2022-09-13 14.01.28.png

  1. Find your fork.

Ekran Resmi 2022-09-13 14.18.47.png

Your fork looks like this:

Ekran Resmi 2022-09-13 14.19.23.png

  1. Make changes to your fork. The easiest way to work in this repository is to press “.” while you’re in your fork to let GitHub web IDE open. Another way is to clone the repository through your computer (if this is a code change you shouldn’t use GitHub IDE). https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository 🤖

    Ekran Resmi 2022-09-13 14.22.00.png

    1. Pro tip: please make your changes atomic. ⚛️ This means that you should make one change at a time. Fix one thing at a time and have one PR and one dedicated branch at your fork for that. Please do not try to fix multiple problems at one PR. While fixing something, if you discovered an irrelevant problem in the codebase, firstly open an issue. If the issue exists, claim it by writing a comment saying you’d like to work on it.
    2. Assume you changed hub-docs/tasks/src/tabular-classification/about.md . Add your changes, commit and push them to your fork, like below 👇

    See what’s changed in the repository with:

    git status

    Add the changed files with git add like below:

    git add tasks/src/fill-mask/about.md

    (or alternatively use git add . to add all the changes you see in git status)

    Commit your work with a message:

    git commit -m "added changes"

    Push:

    git push

    Ekran Resmi 2022-09-13 15.22.21.png

    Ekran Resmi 2022-09-13 15.21.47.png

    Pro tip: It’s usually that you will see people doing git add . . This means that you’d like to add all the changed files and commit them. While solving a problem or doing a documentation, you might be generating files that are irrelevant to your PR, or making changes (e.g. editing .gitignore which is something we’ve seen a lot!). It’s best if you add changed files, or changed folders, e.g. above you see tasks folder is modified, you can directly do git add tasks to add the changes in whole folder.

    1. Once the changes are pushed, open a pull request to the main repository. This is essentially a request to maintainers to merge your changes with main repository. They will either approve, ask for changes or reject your request. Some PRs might take a while to merge. As maintainers, we appreciate your patience & PR. ❤️

    Ekran Resmi 2022-09-13 15.25.43.png

    Ekran Resmi 2022-09-13 15.26.43.png

    If you don’t think your work is done yet you’d like the maintainers to skim through your code (which is often useful if you’re designing an API or writing something from scratch) open draft PR instead!

    Ekran Resmi 2022-09-13 15.30.44.png

    Oh no I received a merge conflict what do I do? 😧

    So essentially, what happens is that you were trying to write your changes to this repository's main branch. However, since you opened the PR, some changes occurred to that branch in the same files you're modifying. Because of this, there's a conflict. Git says that "for fifth line of the code you wanted to write this, but this line is now changed, so it's better if you adapt your changes on top of these changes".

    Because you're working on a fork of original repository, first you need to have the changes (for main branch) To do so, simply sync your fork first:

    Untitled

    Then on your local repository, do a git pull while you're on main branch of your fork. Then, merge changes from main branch to the branches that your PRs are based on, so that those branches are updated too! This will bring the changes on your local and raise a merge conflict that you can solve through your IDE. It looks like below:

    When making changes, think of how you want the document to look like and accept/reject changes accordingly. It's encouraged that you respect other contributors' contributions and append your changes on top of theirs. (Unless it's a fix!)

    Untitled

    Once you resolve the conflicts, simply add, commit and push your changes.

    Some tips in committing code PRs:

    Some tips in technical writing/documentation PRs:

Add your Space to 🤗Tasks!