Skip to content

Commit e7befb4

Browse files
committed
add pages and gifs for submitting PR
1 parent c8b97fb commit e7befb4

11 files changed

Lines changed: 142 additions & 3 deletions

docs/ACKNOWLEDGEMENTS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Mozilla Science Lab and contributors (2018). A Friendly Github Intro Workshop. h
2020
https://github.com/KirstieJane/STEMMRoleModels
2121

2222

23-
https://github.com/ohbm/osr2020
2423

25-
http://www.ee.surrey.ac.uk/Teaching/Unix/unix1.html
24+
25+
https://carpentries-incubator.github.io/building-websites-with-jekyll-and-github-or-gitlab/
26+
27+
https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github-3/
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: default
33
title: 3. Contribute to docs
44
nav_order: 3
55
parent: Tutorials
6-
has_children: false
6+
has_children: true
77
---
88

99

@@ -14,3 +14,7 @@ Submit a request to amend someone else's documentation on a GitHub repository
1414
{: .fs-6 .fw-300 }
1515

1616
---
17+
18+
## Your first encounter with a documentation repository
19+
20+
If you're anything like me, you will start this journey by encountering other peoples documentation before you're ready to start creating your own.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
layout: default
3+
title: 3.1 Stranger or collaborator
4+
nav_order: 1
5+
grans_parent: Tutorials
6+
parent: 3. Contribute to docs
7+
has_children: false
8+
---
9+
10+
11+
# Are you a stranger or a known collaborator?
12+
{: .fs-8 }
13+
14+
Two ways to contribute, depending on whether you are already known to and trusted by the repository owner
15+
{: .fs-6 .fw-300 }
16+
17+
---
18+
19+
## Assuming you are a "stranger" to the repository owner
20+
21+
In my experience a contribution to a repository doesn't come out of nowhere. Often you will have been having a bit of a chat in someone's repository issues (more on that later), and they will say, "Hey, that's a great idea! Do you want to submit a pull request?!". Here is your invitation to contribute!
22+
23+
By "stranger" I mean that you are not one of the people who have access to make changes to the repository without going through a gate keeper. Your gate keeper is the process of the pull request, and its review by the repository owner.
24+
25+
26+
27+
## If you know the repository owner
28+
29+
You can also submit changes in a more straight forward way if you have ben added as a collaborator to a repository. This requires the repository owner to have agreed this with you in advance, which we're not going to assume has happened here. You can follow a detailed presentation on [how to add collaborators to your repository here]()https://docs.google.com/presentation/d/1VasZl8YsYMfhi1zYaYZ-kWykjp4T-ZqE5YrOImsC_Kg/edit#slide=id.g1568089626_6_46)

docs/tut/3-2-fork-their-repo.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
layout: default
3+
title: 3.2 Make a copy and submit a PR
4+
nav_order: 1
5+
grans_parent: Tutorials
6+
parent: 3. Contribute to docs
7+
has_children: false
8+
---
9+
10+
11+
# Make a copy and submit a pull request (PR)
12+
{: .fs-8 }
13+
14+
Get your own copy of someone else's material, so you can make changes and send them back for review as a pull request (PR)
15+
{: .fs-6 .fw-300 }
16+
17+
---
18+
19+
This bit has a few stages, but git error messages and the GitHub web interface are here to help you out.
20+
21+
In this example I'm going to add some text to a repository that I do not own and I am not a contributor to.
22+
23+
For background, the repository is [Open Brain Consent](https://open-brain-consent.readthedocs.io/en/stable/index.html), which describes practical considerations and solutions relating to the open sharing of brain imaging data (my research field). I've been chatting with the repository owners, and they are expecting me to make this contribution 😊
24+
25+
## 1. Fork their repository
26+
27+
Once you have found the documentation you want to contribute to, you need to locate it on GitHub. Many sites will have a handy "Edit on GitHub" link (or something similar), particularly if they *want* you to contribute.
28+
29+
When you have found the GitHub repository, you need to "fork" it, to create a copy in your own GitHub account.
30+
31+
![gif-fork-repo](../../img/gifs/fork-repo.gif)
32+
33+
## 2. Clone your online copy to your local computer
34+
35+
Now you have an online copy of the code, you need to bring it down to your local computer with the "clone" command.
36+
37+
Get the https address of the repository you want to clone via the "code" button, click the "copy" button, then past the address into your command line application at the end of the command below:
38+
39+
`git clone [https-address]`
40+
41+
![gif-fork-repo-clone](../../img/gifs/fork-repo-clone.gif)
42+
43+
## 3. Create a branch
44+
45+
Before you start editing your local copy, it is good practice to create all your edits on a separate "branch" of the code. Creating a new branch makes a unique set of code changes with a unique name, and your branch may have multiple commits. Separating your edits onto a new branch makes it easier for the repository owner to isolate the changes you have made and integrate them into your repository with confidence.
46+
47+
Create your branch by entering the command below, replacing `[your-branch-name]` with something which broadly identifies the changes you are going to make.
48+
49+
`git checkout -b [your-branch-name]`
50+
51+
![gif-create-branch](../../img/gifs/create-branch.gif)
52+
53+
## 4. Make and push your changes
54+
55+
Now you can set about making your edit!
56+
57+
First confirm you are working on the new branch with the command below:
58+
59+
`git branch`
60+
61+
Then open your text editor and make and save the changes.
62+
63+
Finally, add, commit and save the changes as described in the earlier [git basics](2-4-git-basics.md)
64+
65+
Notice the git gave me a helpful error which told me that it din't know where to push my changes - there was not "upstream branch" - and very kindly told me what commands I need to enter to set the upstream to be this branch on my copy of the repository. Thanks, Git.
66+
67+
![gif-make-edits-to-forked-repo](../../img/gifs/make-edits-to-forked-repo.gif)
68+
69+
## 5. Submit your pull request master
70+
71+
Once your changes have been pushed, GitHub online will tell you that your copy and your branch are "ahead of" (have more changes than) the original repository. You can compare the changes and submit your pull request if you are happy with them!
72+
73+
![gif-pull-request](../../img/gifs/pull-request.gif)
74+
75+
Note that depending on how long it has been between you forking the original repository and submitting your pull request, you may have become out of sync with the original if there has been more work done on it. Follow the instructions [here from "7. Sync your forked master branch"](https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github-3/) to get yourself back in sync before submitting your pull request.
76+
77+
## 6. Wait for your pull request to be accepted!
78+
79+
If you're feeling excited by all this wonderful collaboration, jump back into the original repository you cloned from, and check that the pull request is there. You can even write something nice to the repository owners, if you're feeling friendly.
80+
81+
![gif-pull-request-confirmed](../../img/gifs/pull-request-confirmed.gif)
82+
83+
Your pull request will now be reviewed by the repository owners, and you will get an email if/when it has been accepted. Now you have left a comment, you will also be notified when there are additional comments added to your thread.
84+
85+
Sweet! You just contributed to shared documentation! The documentation is now 1000 times better because you added your insight (maybe, probably)! You should do this more often, and help make stuff easier for other people to understand, and distribute the efforts of keeping good documentation relevant! Great job ⭐️
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
layout: default
3+
title: 3.2 Play with this page
4+
nav_order: 10
5+
grans_parent: Tutorials
6+
parent: 3. Contribute to docs
7+
has_children: false
8+
---
9+
10+
11+
# Practice submitting your pull request to update this page
12+
{: .fs-8 }
13+
14+
A safe space for you to submit changes to this very document!
15+
{: .fs-6 .fw-300 }
16+
17+
---
18+
19+
This page is ready for you to update! Using the

img/gifs/create-branch.gif

2.4 MB
Loading

img/gifs/fork-repo-clone.gif

3.87 MB
Loading

img/gifs/fork-repo.gif

2.79 MB
Loading
9.38 MB
Loading

img/gifs/pull-request-confirm.gif

10.4 MB
Loading

0 commit comments

Comments
 (0)