You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/contributing/how-to-open-a-pull-request.md
+31-17Lines changed: 31 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -31,30 +31,40 @@ The Gatsby core team uses a triaging process outlined in [Managing Pull Requests
31
31
32
32
## Opening PRs in Gatsby
33
33
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.
35
35
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.
37
39
38
40
-[Fork and clone the Gatsby repo](/contributing/setting-up-your-local-dev-environment/#gatsby-repo-install-instructions).
39
41
- Install [yarn](https://yarnpkg.com/) to pull in dependencies and build the project.
40
42
- Follow the instructions for the part of the project you want to change. (See specific sections below.)
41
43
-[Create a branch in Git](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging) to isolate your changes:
42
44
43
-
```bash
45
+
```shell
44
46
git checkout -b some-change
45
47
```
46
48
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.
48
50
- Using a dot character `.` will add all untracked files in the current directory and subdirectories.
49
-
```bash
51
+
```shell
50
52
git add .
51
53
```
52
54
- 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
+
```
53
63
- 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
55
65
git push origin head
56
66
```
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.
58
68
59
69
### Documentation PRs
60
70
@@ -79,42 +89,46 @@ There are specific pages about contributing to various parts of the Gatsby ecosy
79
89
80
90
### Blog posts
81
91
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.
83
93
84
94
## Update your fork with the latest Gatsby changes
85
95
86
96
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):
87
97
88
98
- Set Gatsby's repo URL as a remote source. The name of the remote is arbitrary; this example uses `upstream`.
-_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
95
105
git remote -v
96
106
```
97
107
- Fetch the latest changes from Gatsby:
98
-
```bash
108
+
```shell
99
109
git fetch upstream master
100
110
```
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
103
113
git merge upstream master
104
114
```
105
115
- 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.
106
116
- Once your branch is in good working order, push the changes to your fork:
107
-
```bash
117
+
```shell
108
118
git push origin head
109
119
```
110
120
111
121
For more information on working with upstream repos, [visit the GitHub docs](https://help.github.com/en/articles/configuring-a-remote-for-a-fork).
112
122
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)._
114
124
115
125
## Additional resources
116
126
127
+
- CSS Tricks: [How to Contribute to an Open Source Project](https://css-tricks.com/how-to-contribute-to-an-open-source-project/)
117
128
-[Creating a pull request](https://help.github.com/en/articles/creating-a-pull-request) from GitHub
118
129
-[Configuring a remote for a fork](https://help.github.com/en/articles/configuring-a-remote-for-a-fork)
119
130
-[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)
0 commit comments