Skip to content

Commit 5e165b7

Browse files
Barb CutlerBarb Cutler
Barb Cutler
authored and
Barb Cutler
committed
instructions for pushing to a fork
1 parent 9f43687 commit 5e165b7

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

_docs/developer/getting_started/review_a_pull_request.md

+68
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,72 @@ What do you need to do?
109109
the main branch.
110110
111111
112+
### Working with a PR from an External Contributor's fork
113+
114+
An external contributor cannot make new branches on the Submitty
115+
repositories. Instead, external contributors will fork the Submitty
116+
repository and then make a PR from a branch on their fork. We can
117+
collaborate on the PR (e.g., make small revisions) assuming they have
118+
granted permission for collaborators to push to their fork. The
119+
instructions below are for command line use of git, and assume that
120+
you have setup ssh keys for working with github.
121+
122+
123+
1. First, from the PR on github, find the name of the fork + branch
124+
name. It should be formatted something like this:
125+
126+
```
127+
contributorusername:contributor_branch_name
128+
```
129+
130+
2. Next, make a local branch on your computer in your working repository
131+
with the proposed code changes. Here are the command lines
132+
(substitute the fork & branch name we found above):
133+
134+
```
135+
git checkout -b contributorusername-contributor_branch_name main
136+
git pull [email protected]:contributorusername/Submitty.git contributor_branch_name
137+
```
138+
139+
This has made a local branch named
140+
`contributorusername-contributor_branch_name` where you can test and
141+
review the PR and make code edits as needed.
142+
143+
144+
3. Specify the upstream to be the contributors fork:
145+
146+
```
147+
git remote add upstream [email protected]:contributorusername/Submitty.git
148+
```
149+
150+
Confirm that the upstream was set:
151+
```
152+
git remote -v
153+
```
154+
155+
Which should print something like this:
156+
```
157+
origin [email protected]:Submitty/Submitty.git (fetch)
158+
origin [email protected]:Submitty/Submitty.git (push)
159+
upstream [email protected]:contributorusername/Submitty.git (fetch)
160+
upstream [email protected]:contributorusername/Submitty.git (push)
161+
```
162+
163+
4. Now once you are finished with your code changes, commit them to the
164+
local branch (named `contributorusername-contributor_branch_name`).
165+
166+
And then to push them to the external contributor's fork and update
167+
the PR on github:
168+
```
169+
git push upstream contributorusername:contributor_branch_name
170+
```
171+
172+
Confirm that you can see the changes on the Github website for the PR.
173+
174+
If you encounter a permissions error, it is possible that the external
175+
contributor didn't grant access for collaboration on the branch.
176+
177+
178+
---
179+
112180
See also [How to Make a Pull Request](make_a_pull_request).

0 commit comments

Comments
 (0)