Skip to content

Commit f6ae01d

Browse files
author
Marcy Sutton
authored
docs: copy updates for How to Open a PR (#17893)
* copy updates and links * swap bash in favor of shell in examples * updating note about cloning directly vs. forking
1 parent 042338a commit f6ae01d

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

docs/contributing/how-to-open-a-pull-request.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,40 @@ The Gatsby core team uses a triaging process outlined in [Managing Pull Requests
3131

3232
## Opening PRs in Gatsby
3333

34-
For any kind of change to files in the Gatsby repo, you can follow the below steps. Be sure to check out additional tips for contributing to various parts of the repo later in this doc, such as docs changes, blog posts, starters, or code improvements.
34+
For any kind of change to files in the Gatsby repo, you can follow the below steps. Be sure to check out additional tips for contributing to various parts of the repo later in this doc, such as docs changes, blog posts, starters, or code improvements and tests.
3535

36-
Some PRs can be done completely from the [GitHub UI](https://help.github.com/en/articles/creating-a-pull-request). To test changes locally against the Gatsby [site and project files](https://github.com/gatsbyjs/gatsby), you can fork the repo and install parts of it to run on your local machine.
36+
Some PRs can be done completely from the [GitHub UI](https://help.github.com/en/articles/creating-a-pull-request), such as edits to README files or docs.
37+
38+
To test changes locally against the Gatsby [site and project files](https://github.com/gatsbyjs/gatsby), you can fork the repo and install parts of it to run on your local machine.
3739

3840
- [Fork and clone the Gatsby repo](/contributing/setting-up-your-local-dev-environment/#gatsby-repo-install-instructions).
3941
- Install [yarn](https://yarnpkg.com/) to pull in dependencies and build the project.
4042
- Follow the instructions for the part of the project you want to change. (See specific sections below.)
4143
- [Create a branch in Git](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging) to isolate your changes:
4244

43-
```bash
45+
```shell
4446
git checkout -b some-change
4547
```
4648

47-
- Once you have changes in Git you want to push, [add them and create a commit](https://help.github.com/en/articles/adding-a-file-to-a-repository-using-the-command-line).
49+
- Once you have changes in Git you want to push, [add them and create a commit](https://help.github.com/en/articles/adding-a-file-to-a-repository-using-the-command-line). For information on how to structure your commits, check out the [Managing PRs](/contributing/managing-pull-requests/#commit-and-pr-title) doc.
4850
- Using a dot character `.` will add all untracked files in the current directory and subdirectories.
49-
```bash
51+
```shell
5052
git add .
5153
```
5254
- Using a visual tool like [GitHub Desktop](https://desktop.github.com/) or [GitX](https://rowanj.github.io/gitx/) can help for choosing which files and lines to commit.
55+
- Committing code will run the automated linter using [Prettier](https://prettier.io). To run the linter manually, run an npm script in the project's base directory:
56+
```shell
57+
npm run format
58+
```
59+
- Commit any linting changes before pushing by [amending the previous commit](https://help.github.com/en/articles/changing-a-commit-message) or by adding a new commit. For more on linting and tests, visit the [Managing PRs](/contributing/managing-pull-requests/#automated-checks) doc.
60+
```shell
61+
git commit --amend
62+
```
5363
- Push your changes to your fork, assuming it is set up as [`origin`](https://www.git-tower.com/learn/git/glossary/origin):
54-
```bash
64+
```shell
5565
git push origin head
5666
```
57-
- To open the PR against the Gatsby repo, you can use the [GitHub Pull Request UI](https://help.github.com/en/articles/creating-a-pull-request), or the command line: we recommend [hub](https://github.com/github/hub) for that.
67+
- To open a PR with your changes against the Gatsby repo, you can use the [GitHub Pull Request UI](https://help.github.com/en/articles/creating-a-pull-request). Alternatively, you can use the command line: we recommend [hub](https://github.com/github/hub) for that.
5868

5969
### Documentation PRs
6070

@@ -79,42 +89,46 @@ There are specific pages about contributing to various parts of the Gatsby ecosy
7989

8090
### Blog posts
8191

82-
For the Gatsby blog, it's necessary to run your content idea by the Gatsby team before submitting it. For more information, refer to the page on [blog and website contributions](/contributing/blog-and-website-contributions/).
92+
For the Gatsby blog, it's necessary to run your content idea by the Gatsby team before submitting it. For more information, refer to the page on [blog and website contributions](/contributing/blog-and-website-contributions/), including how to propose an idea and setting up the blog to run locally.
8393

8494
## Update your fork with the latest Gatsby changes
8595

8696
The Gatsby GitHub repo is very active, so it's likely you'll need to update your fork with the latest changes to be able to merge in your code. This requires adding Gatsby as an [upstream remote](https://help.github.com/en/articles/configuring-a-remote-for-a-fork):
8797

8898
- Set Gatsby's repo URL as a remote source. The name of the remote is arbitrary; this example uses `upstream`.
89-
```bash
99+
```shell
90100
git remote set-url upstream [email protected]:gatsbyjs/gatsby.git
91101
```
92-
- _Note: this syntax [uses SSH: you can also use `https`](https://help.github.com/en/articles/which-remote-url-should-i-use) and your username/password._
93-
- You can also verify the remote name and URL at any time:
94-
```bash
102+
- _Note: this syntax [uses SSH and keys: you can also use `https`](https://help.github.com/en/articles/which-remote-url-should-i-use) and your username/password._
103+
- You can verify the remote name and URL at any time:
104+
```shell
95105
git remote -v
96106
```
97107
- Fetch the latest changes from Gatsby:
98-
```bash
108+
```shell
99109
git fetch upstream master
100110
```
101-
- In the branch you want to update, merge any changes from Gatsby into your fork:
102-
```bash
111+
- [In the branch](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging) you want to update, merge any changes from Gatsby into your fork:
112+
```shell
103113
git merge upstream master
104114
```
105115
- If there are any [merge conflicts](https://help.github.com/en/articles/resolving-a-merge-conflict-on-github), you'll want to address those to get a clean merge.
106116
- Once your branch is in good working order, push the changes to your fork:
107-
```bash
117+
```shell
108118
git push origin head
109119
```
110120

111121
For more information on working with upstream repos, [visit the GitHub docs](https://help.github.com/en/articles/configuring-a-remote-for-a-fork).
112122

113-
_**Note:** as a member of the Gatsby repo, you can also clone it directly and push to feature branches._
123+
_**Note:** as a member of the Gatsby repo, you can also clone it directly instead of forking and push your changes to [feature branches](https://git-scm.com/book/en/v1/Git-Branching-Branching-Workflows)._
114124

115125
## Additional resources
116126

127+
- CSS Tricks: [How to Contribute to an Open Source Project](https://css-tricks.com/how-to-contribute-to-an-open-source-project/)
117128
- [Creating a pull request](https://help.github.com/en/articles/creating-a-pull-request) from GitHub
118129
- [Configuring a remote for a fork](https://help.github.com/en/articles/configuring-a-remote-for-a-fork)
119130
- [Which remote URL should I use?](https://help.github.com/en/articles/which-remote-url-should-i-use)
131+
- [Git Branching and Merging](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging)
132+
- [Feature Branching and Workflows](https://git-scm.com/book/en/v1/Git-Branching-Branching-Workflows)
120133
- [Resolving merge conflicts](https://help.github.com/en/articles/resolving-a-merge-conflict-on-github)
134+
- [Managing Pull Requests](/contributing/managing-pull-requests/) on the Gatsby core team

0 commit comments

Comments
 (0)