Skip to content

Commit c0d025b

Browse files
committed
Add more info, clean up text and definitions
1 parent 3c883cd commit c0d025b

File tree

1 file changed

+273
-13
lines changed

1 file changed

+273
-13
lines changed

CONTRIBUTING_PRs.md

Lines changed: 273 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,285 @@
22

33
## Quick start guide for experienced Github users (on a Linux host)
44

5-
On Github
5+
### Part A: On Github
66

7-
1. Get your own Github account
8-
1. Define a token (??name) to allow command line access from your local host to your Github account
9-
1. Assign the token in your local git resource file (??name)
10-
1. Fork this repository to your account
7+
1. Get your own Github account and login to it
8+
2. Provide an SSH PUBLIC key to allow command line access from your local host to your Github account
9+
1. Select the drop-down arrow by your avatar or picture at the top-right of the black user account bar
10+
2. Select "Settings" on the menu
11+
3. Select "SSH and GPG keys" from the left-side menu
12+
4. Select the green "New SSH key" widget at the top right of the window
13+
5. Generate your SSH key pair on your local host
14+
6. Copy your PUBLIC key into the window and give it a meaningfule title (such as the host name with the private key)
15+
3. Back in this repository, fork this repository to your account by clicking on the "Fork" button at the top-right of this repository
1116

12-
On your local host:
17+
### Part B: On your local host
1318

1419
1. Clone the repository to your local host as the origin
15-
1. Set the remotes as "origin" for your own Github repo and "upstream" for the Raku/doc repo
16-
1. Check out a new branch to make your changes
17-
1. When ready to submit the PR, commit your changes with a good commit message
18-
1. Push the new branch to your Github account
20+
2. Set the remotes as "origin" for your own Github repo and "upstream" for the Raku/doc repo
21+
3. Check out a new branch to make your changes
22+
4. When ready to submit the PR, commit your changes with a good commit message
23+
5. Push the new branch to your Github account
1924

20-
On your Github repo
25+
### Part C: On your Github repo
2126

2227
1. Submit the PR
23-
1. Await approval or further action or guidance from someone who has a commit bit
24-
1. If no action is seen for a day, politely ping someone on the #raku IRC channel
28+
2. Await approval or further action or guidance from someone who has a commit bit
29+
3. If no action is seen for a day, politely ping someone on the #raku IRC channel
30+
31+
### For future and easier forking of public repositories
32+
33+
Install the Perl module [App::GitGot](https://metacpan.org/pod/App::GitGot)
2534

2635
## Detailed guide for newcomers
36+
37+
For this detailed guide we will assume you have a Github account with
38+
user name "grace", so your on-line account is accessed at
39+
[https://github.com/grace](https://github.com/grace). In all the
40+
following instructions, replace "grace" with your real Github account
41+
name.
42+
43+
Go to your Github account page and select the "Repositories" tab. Make
44+
sure you don't have one named "doc" since we are going to fork that
45+
from the [https://github.com/raku/doc](https://github.com/raku/doc) repository.
46+
47+
### Part A: On Github
48+
49+
At this point you are ready to fork generate and provide an SSH public
50+
key to provide command-line access from your local host to your Github
51+
account and then fork this repository. Complete the instructions in
52+
**Part A** above. (If you do not know how to create the SSH key pair,
53+
then you are probably not ready for the rest of this recipe until you
54+
can do so. Ask for help on one of the Linux mailing lists.)
55+
56+
If your fork was successful, you should now be in your account at page
57+
[https://github.com/grace/doc](https://github.com/grace/doc) with the forked
58+
version.
59+
60+
We can see the actual Github path for the clone step by clicking on the
61+
green "Clone or download" button at the top right of the "<> Code" tab.
62+
We choose the "Clone with SSH" method which shows "git@github.com:grace/doc.git".
63+
64+
### Part B: On your local host
65+
66+
1. Clone the repository to your local host as the origin
67+
68+
We first determine a directory where we want to clone forked repositories. For this
69+
example we'll use "~grace/repo-forks".
70+
71+
```Raku
72+
$ cd
73+
$ mkdir repo-forks
74+
$ cd repo-forks
75+
```
76+
77+
Now do the actual cloning of our fork using the path we determined on
78+
our Github account:
79+
80+
```Raku
81+
$ git clone git@github.com:grace/doc.git
82+
Cloning into 'doc'...
83+
Warning: Permanently added the RSA host key for IP address '192.30.255.113' to the list of known hosts.
84+
X11 forwarding request failed on channel 0
85+
remote: Enumerating objects: 5, done.
86+
remote: Counting objects: 100% (5/5), done.
87+
remote: Compressing objects: 100% (5/5), done.
88+
remote: Total 65973 (delta 0), reused 1 (delta 0), pack-reused 65968
89+
Receiving objects: 100% (65973/65973), 19.41 MiB | 9.60 MiB/s, done.
90+
Resolving deltas: 100% (48706/48706), done.
91+
```
92+
93+
2. Set the remotes as "origin" for your own Github repo and "upstream"
94+
for the Raku/doc repo
95+
96+
CD into the new repo to check:
97+
98+
```Raku
99+
$ cd doc
100+
$ git remote -v
101+
origin git@github.com:grace/doc.git (fetch)
102+
origin git@github.com:grace/doc.git (push)
103+
```
104+
105+
Add the upstream repo (we will use the https protocol for read-only access):
106+
107+
```Raku
108+
$ git remote add upstream https://github.com/raku/doc
109+
```
110+
111+
and notice the new remotes have been added:
112+
113+
```Raku
114+
$ git remote -v
115+
origin git@github.com:grace/doc.git (fetch)
116+
origin git@github.com:grace/doc.git (push)
117+
upstream https://github.com/raku/doc (fetch)
118+
upstream https://github.com/raku/doc (push)
119+
```
120+
121+
Check what branches we have:
122+
123+
```Raku
124+
$ git branch
125+
* master
126+
```
127+
128+
We have only one branch at the moment, the *master* branch. The asterisk
129+
shows we have that branch checked out, and it is the one to which we want
130+
to make changes, but only by using a PR.
131+
132+
3. Check out a new branch to make your changes
133+
134+
We now want to start with some changes and we'll do that on our own
135+
branch. Pick a name that is short but meaningful. We use the "-b"
136+
option to automatically checkout the new branch.
137+
138+
```Raku
139+
$ git checkout -b fix-typo
140+
Switched to a new branch 'fix-typo'
141+
```
142+
143+
Check the branches now:
144+
145+
```Raku
146+
$ git branch
147+
* fix-typo
148+
master
149+
```
150+
151+
Now we're on the new branch as seen by the new branch name and the
152+
asterisk by it.
153+
154+
For this example I've found a typo in file
155+
"writing-docs/STYLEGUIDE.md" on line 74 where the word "exposition" I
156+
believe should be "exposure" and then I see some other changes needed,
157+
so I modify the whole paragraph on my local copy.
158+
159+
I can check the status of my change:
160+
161+
```Raku
162+
$ git status
163+
On branch fix-typo
164+
Changes not staged for commit:
165+
(use "git add <file>..." to update what will be committed)
166+
(use "git checkout -- <file>..." to discard changes in working directory)
167+
168+
modified: writing-docs/STYLEGUIDE.md
169+
170+
no changes added to commit (use "git add" and/or "git commit -a")
171+
```
172+
173+
I can check the differences between my branch and the master branch:
174+
175+
```Raku
176+
$ git diff
177+
diff --git a/writing-docs/STYLEGUIDE.md b/writing-docs/STYLEGUIDE.md
178+
index 265956373..7a0573209 100644
179+
--- a/writing-docs/STYLEGUIDE.md
180+
+++ b/writing-docs/STYLEGUIDE.md
181+
@@ -71,11 +71,9 @@ Try to avoid abbreviations. For example, <E2><80><9C>RHS<E2><80><9D> is short, but
182+
<E2><80><9C>right-hand side<E2><80><9D> is much clearer for beginners.
183+
184+
In general, try to put yourself in the shoes of someone with no
185+
-previous exposition to the language (or computer science
186+
-altogether). Although it might seem obvious to
187+
-you that only the first line can in fact initialize a hash, the
188+
-documentation is targeted at people with no previous exposure to the
189+
-language.
190+
+previous exposure to the language or computer science. Although it
191+
+might seem obvious to you that only the first line can in fact
192+
+initialize a hash, the documentation is targeted at such novices.
193+
194+
### 'say' vs 'put'
195+
196+
```
197+
198+
4. When ready to submit the PR, commit your changes with a good commit message
199+
200+
I'm happy with my changes so I commit the chages:
201+
202+
```Raku
203+
$ git commit -a -m"Use better word than 'exposition' and reword the paragraph"
204+
[fix-typo 699343c65] Use better word than 'exposition' and reword the paragraph
205+
1 file changed, 3 insertions(+), 5 deletions(-)
206+
```
207+
208+
The "-a" option is one of many options to "commit" instead of using file names.
209+
210+
5. Push the new branch to your Github account
211+
212+
```Raku
213+
$ git push origin fix-typo
214+
X11 forwarding request failed on channel 0
215+
Enumerating objects: 7, done.
216+
Counting objects: 100% (7/7), done.
217+
Delta compression using up to 8 threads
218+
Compressing objects: 100% (4/4), done.
219+
Writing objects: 100% (4/4), 495 bytes | 495.00 KiB/s, done.
220+
Total 4 (delta 3), reused 0 (delta 0)
221+
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
222+
remote:
223+
remote: Create a pull request for 'fix-typo' on GitHub by visiting:
224+
remote: https://github.com/tbrowder/doc/pull/new/fix-typo
225+
remote:
226+
To github.com:tbrowder/doc.git
227+
* [new branch] fix-typo -> fix-typo
228+
```
229+
230+
Now you can go back to Github to submit the PR.
231+
232+
### Part C: On your Github account
233+
234+
Back on your Github account in your fork of "doc" you should see near
235+
the top of the "<> Code" tab some new text saying "You recently
236+
pushed branches:" above a new yellow bar saying at its left side
237+
"fix-typo (5 minutes ago)" and at its right side a green button saying
238+
"Compare & pull request."
239+
240+
If you're satisfied with everything so far, then push the "Compare &
241+
pull request" button.
242+
243+
Next pops up a window on the "raku/doc" repo where you are to complete a form
244+
explaining in more detail the problem and solution provide as well as
245+
possibly more details. In this instance I believe it is clear but I will
246+
add some entries into the template:
247+
248+
```Raku
249+
## The problem
250+
251+
The paragraph as written uses an incorrect word ("exposition" instead of
252+
"exposure").
253+
254+
## Solution provided
255+
256+
The word was corrected and the paragraph reworded to remove redundancy
257+
and improve the overall wording.
258+
```
259+
260+
Then, at the bottom of that window I push the green button labeled
261+
"Create pull request."
262+
263+
Next, the PR is created and I can either wait for action or I can
264+
select a reviewer from the list of reviewers on the right of the
265+
window (there may not always be a list shown). In this case I left it
266+
alone.
267+
268+
## Summary
269+
270+
This has been a *very basic recipe* to get a new contributor through the
271+
basic steps of contributing a PR for the "docs."
272+
273+
A major advantage of the PR over the bug report for you, the
274+
contributor is you get to make the **exact** changes you think should
275+
be made. A major advantage for the developers is they can make detailed
276+
suggestions **before** the PR is finalized.
277+
278+
## Note
279+
280+
The example PR was actually submitted and merged (closed) as "raku/doc" PR #3174.
281+
282+
## References
283+
284+
1. [Github: About pull requests](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
285+
286+
2. [Git documentation](https://git-scm.com/doc)

0 commit comments

Comments
 (0)