Skip to content

Github "Fork ➡ Dev ➡ Pull Request" Flow

Rey Dekker edited this page Oct 1, 2020 · 5 revisions

TLDR; How to do code contribution

This will be the main flow for open source contributions.

Fork

  1. Fork the repo by clicking "Fork" on the top right of this page.
  2. This will start a flow of creating the repo under your Github account. This is what we need to happen, even if it might seem odd the first time. This is just the traditional way to contribute to open source. Screen Shot 2020-09-20 at 4 36 04 pm
  3. Clone your GitHub to your locale machine.
  4. In your local machine, navigate to the GitHub repo for the project.
  5. From this folder do the following steps:
  6. git remote add upstream https://github.com/shescoding/projects-platform-frontend.git
  7. git fetch upstream
  8. git checkout master
  9. git merge upstream/master
  10. git remote -v should show (NOTE: nurmerey is example username. This should be your username in the console instead):
origin	https://github.com/nurmerey/projects-platform-frontend.git (fetch)
origin	https://github.com/nurmerey/projects-platform-frontend.git (push)
upstream	https://github.com/shescoding/projects-platform-frontend.git (fetch)
upstream	https://github.com/shescoding/projects-platform-frontend.git (push)

Dev

  1. Clone the forked repo to your local machine.
  2. Follow the installation guide in the wiki.
  3. Create a feature branch with the appropriate name, ex: "feature-filter-api" and go ahead and code up the solution for the issue at hand. Screen Shot 2020-09-20 at 4 13 22 pm

Create a Pull Request (aka PR)

  1. One way to create a PR is to just use Github App interface "Branch -> Create Pull Request" from the branch you have worked on. Here is another way of doing it.

Screen Shot 2020-09-20 at 4 10 49 pm Screen Shot 2020-09-20 at 5 49 06 pm

Example PR from fork: https://github.com/shescoding/projects-platform-frontend/pull/129

  1. In the pull request interface that you see in Github:
    • Make sure to look into 2 tabs - "Conversations" and "File Changes".
    • In "File Changes" - make sure all the diffs (red and green changes) look correct. This is a good opportunity to catch extra "console.log" or wrong file or variable names.
    • In "Conversations":
      • If this PR is has a frontend change - please attached a screenshot that demonstrates it.
      • yarn test -u update snapshot test
      • Shortly summarize the impact of this change, and how you tested it.
      • As someone to review this pull request.
        Screen Shot 2020-09-20 at 4 19 05 pm
  • It is ok to get a PR when it is not yet ready. This provides visibility to your work and might help you discuss a solution with other collaborators. If this is a case add a "WIP" (Work In Progress) label to it. Remember to remove it when this is over.
  1. Go ahead and click "Publish".

Useful materials: