diff --git a/doc/source/dev/checking_out_an_upstream_pr.md b/doc/source/dev/checking_out_an_upstream_pr.md new file mode 100644 index 0000000..9dcc892 --- /dev/null +++ b/doc/source/dev/checking_out_an_upstream_pr.md @@ -0,0 +1,49 @@ +# Editing another person's pull request + +## Respect + +Please be respectful of other's work. + +## Expected setup + +This guide expects that you have set up your git environment as is outlined in [getting_the_code](getting_the_code.md). +In particular, it assumes that you have: + +1. a remote called ``origin`` for your fork of NumPy-Financial +2. a remote called ``upstream`` for the original fork of NumPy-Financial + +You can check this by running: + +```shell +git remote -v +``` + +Which should output lines similar to the below: + +``` +origin https://github.com//numpy-financial.git (fetch) +origin https://github.com//numpy-financial.git (push) +upstream https://github.com/numpy/numpy-financial.git (fetch) +upstream https://github.com/numpy/numpy-financial.git (push) +``` + +## Accessing the pull request + +You will need to find the pull request ID from the pull request you are looking at. Then you can fetch the pull request and create a branch in the process by: + +```shell +git fetch upstream pull//head: +``` + +Where: + +* ```` is the id that you found from the pull request +* ```` is the name that you would like to give to the branch once it is created. + +Note that the branch name can be anything you want, however it has to be unique. + +## Switching to the new branch + +```shell +git switch +``` diff --git a/doc/source/dev/getting_the_code.md b/doc/source/dev/getting_the_code.md index 7aa822a..9658dd1 100644 --- a/doc/source/dev/getting_the_code.md +++ b/doc/source/dev/getting_the_code.md @@ -22,6 +22,55 @@ git clone https://github.com//numpy-financial.git Hooray! You now have a working copy of NumPy-Financial. +## Adding the upstream repo + +Now that your fork of NumPy-Financial is available locally, it is worth adding the upstream repository as a remote. + +You can view the current remotes by running: + +```shell +git remote -v +``` + +This should produce some output similar to: + +```shell +origin https://github.com//numpy-financial.git (fetch) +origin https://github.com//numpy-financial.git (push) +``` + +Now tell git that there is a remote repository that we will call ``upstream`` pointing to the numpy-financial repository: + +```shell +git remote add upstream https://github.com/numpy/numpy-financial.git +``` + +We can now check the remotes again: + +```shell +git remote -v +``` + +which gives two additional lines as output: + +```shell +origin https://github.com//numpy-financial.git (fetch) +origin https://github.com//numpy-financial.git (push) +upstream https://github.com/numpy/numpy-financial.git (fetch) +upstream https://github.com/numpy/numpy-financial.git (push) +``` + + +## Pulling from upstream by default + +We want to be able to get the changes from the upstream repo by default. This way you pull the most recent changes into your repo. + +To set up your repository to read from the remote that we called `upstream`: + +```shell +git config branch.main.remote upstream +git config branch.main.merge refs/heads/main +``` ## Updating the code with other's changes