Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions doc_developer/editing_someone_elses_pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Editing another person's pull request

## Respect

Please be respectful of other's work.

#TODO: Guide people on how to be respectful

## 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/<your_username>/numpy-financial.git (fetch)
origin https://github.com/<your_username>/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/<ID>/head:<BRANCH_NAME>
```

Where:

* ``<ID>`` is the id that you found from the pull request
* ``<BRANCH_NAME>`` 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 <BRANCH_NAME>
```
49 changes: 49 additions & 0 deletions doc_developer/getting_the_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,55 @@ git clone https://github.com/<your_username>/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/<your_username>/numpy-financial.git (fetch)
origin https://github.com/<your_username>/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/<your_username>/numpy-financial.git (fetch)
origin https://github.com/<your_username>/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

Expand Down