Skip to content

Working with a Forked Repository

Shahin Saadati edited this page Apr 12, 2022 · 5 revisions

As a contributor to this repository, you are likely going to submit your work from a forked repository. In this page, we go over the general steps as well as some tips about working with a forked repository.

In order to fork the repo, simply click on the Fork button on the top-right corner of this page and follow the instructions to create a fork of this repo under your account.

Tips

Configure the upstream repo

If you are planning to develop your code locally and submit a Pull Request for review, you will require to add the original repo as upstream. Here are the steps to do it:

  • Clone the forked repo on your machine:
git clone [email protected]:YOUR_GITHUB_ID/public-datasets-pipelines.git
  • Set up the original repo as upstream:

Go to the root directory of the cloned repo and use this command to set up the upstream:

git remote add upstream https://github.com/GoogleCloudPlatform/public-datasets-pipelines.git
  • Verify that it was added:
git remote -v

Useful Git Commands

  • Add a file to source control:
git add filename
  • Commit your changes:
git commit -m "A DESCRIPTION OF THE CHANGES IN THIS COMMIT"

Submit your Code via GitHub UI

If your code is simple, containing only 1-2 files, you might want to skip using the git command altogether and submit your code from the GitHub UI directly.

On the forked repo page, open the directory that your file should be placed in. Use the Add File option to create a new file, or upload your files into your forked repo. Provide a commit message for the new file(s). That is all.

Submit a PR (Pull Request)

Once your code is ready for review, you will need to create a PR and submit it for code review. Open the Github page for your forked repo. On that page, you will see an option to Fetch Upstream, as shown in this image:

Fetch Upstream

By clicking on this option, you will sync up your forked repo with the original one, downloading all the recent changes into your forked repo. This might cause some merging conflicts that need be resolved. Otherwise, you should be ready to create a PR. Click on Contribute to create a new PR. Make sure to check the boxes in the description of the PR accordingly to help the reviewer understand what your PR is about.

If your PR is to add a new feature (e.g. a new pipeline or a tutorial), Make sure to prefix the PR title with Feat:. If you are fixing a bug, then use Fix: instead.

Once your PR is created, go to the page for the original repo and find your PR under the Pull requests tab. Make sure all the tests are passed and that you have assigned at least one reviewer to review your PR.