File tree Expand file tree Collapse file tree 2 files changed +98
-0
lines changed Expand file tree Collapse file tree 2 files changed +98
-0
lines changed Original file line number Diff line number Diff line change 1+ # Editing another person's pull request
2+
3+ ## Respect
4+
5+ Please be respectful of other's work.
6+
7+ ## Expected setup
8+
9+ This guide expects that you have set up your git environment as is outlined in [ getting_the_code] ( getting_the_code.md ) .
10+ In particular, it assumes that you have:
11+
12+ 1 . a remote called `` origin `` for your fork of NumPy-Financial
13+ 2 . a remote called `` upstream `` for the original fork of NumPy-Financial
14+
15+ You can check this by running:
16+
17+ ``` shell
18+ git remote -v
19+ ```
20+
21+ Which should output lines similar to the below:
22+
23+ ```
24+ origin https://github.com/<your_username>/numpy-financial.git (fetch)
25+ origin https://github.com/<your_username>/numpy-financial.git (push)
26+ upstream https://github.com/numpy/numpy-financial.git (fetch)
27+ upstream https://github.com/numpy/numpy-financial.git (push)
28+ ```
29+
30+ ## Accessing the pull request
31+
32+ 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:
33+
34+ ``` shell
35+ git fetch upstream pull/< ID> /head:< BRANCH_NAME>
36+ ```
37+
38+ Where:
39+
40+ * `` <ID> `` is the id that you found from the pull request
41+ * `` <BRANCH_NAME> `` is the name that you would like to give to the branch once it is created.
42+
43+ Note that the branch name can be anything you want, however it has to be unique.
44+
45+ ## Switching to the new branch
46+
47+ ``` shell
48+ git switch < BRANCH_NAME>
49+ ```
Original file line number Diff line number Diff line change @@ -22,6 +22,55 @@ git clone https://github.com/<your_username>/numpy-financial.git
2222
2323Hooray! You now have a working copy of NumPy-Financial.
2424
25+ ## Adding the upstream repo
26+
27+ Now that your fork of NumPy-Financial is available locally, it is worth adding the upstream repository as a remote.
28+
29+ You can view the current remotes by running:
30+
31+ ``` shell
32+ git remote -v
33+ ```
34+
35+ This should produce some output similar to:
36+
37+ ``` shell
38+ origin https://github.com/< your_username> /numpy-financial.git (fetch)
39+ origin https://github.com/< your_username> /numpy-financial.git (push)
40+ ```
41+
42+ Now tell git that there is a remote repository that we will call `` upstream `` pointing to the numpy-financial repository:
43+
44+ ``` shell
45+ git remote add upstream https://github.com/numpy/numpy-financial.git
46+ ```
47+
48+ We can now check the remotes again:
49+
50+ ``` shell
51+ git remote -v
52+ ```
53+
54+ which gives two additional lines as output:
55+
56+ ``` shell
57+ origin https://github.com/< your_username> /numpy-financial.git (fetch)
58+ origin https://github.com/< your_username> /numpy-financial.git (push)
59+ upstream https://github.com/numpy/numpy-financial.git (fetch)
60+ upstream https://github.com/numpy/numpy-financial.git (push)
61+ ```
62+
63+
64+ ## Pulling from upstream by default
65+
66+ 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.
67+
68+ To set up your repository to read from the remote that we called ` upstream ` :
69+
70+ ``` shell
71+ git config branch.main.remote upstream
72+ git config branch.main.merge refs/heads/main
73+ ```
2574
2675## Updating the code with other's changes
2776
You can’t perform that action at this time.
0 commit comments