Welcome to our gatsby starter repository. We welcome any kind of contributions!
Follow these steps in order to contribute:
-
Find an open issue or one that needs assistance.
-
Inform us when you are working on something by posting a comment in the issue.
-
Follow the Contribution Guidelines to start working on the issue.
- Install Git or your favorite Git client.
- (Optional) Setup an SSH Key for GitHub.
- Go to the top level of the repository: https://github.com/Knochenmark/gatsby-starter-level-2
- Click the "Fork" Button in the upper right hand corner of the interface (More Details Here)
- After the repository (repo) has been forked, you will be taken to your copy of the repo at https://github.com/yourUsername/gatsby-starter-level-2
- Open a Terminal / Command Line / Bash Shell in your projects directory (i.e.:
/yourprojectdirectory/
) - Clone your fork
$ git clone https://github.com/yourUsername/gatsby-starter-level-2.git
(make sure to replace yourUsername
with your GitHub username)
This will download the entire repo to your projects directory.
- Change directory to the new directory (
cd gatsby-starter-level-2
) - Add a remote to the original gatsby-starter-level-2 repo:
$ git remote add upstream https://github.com/Knochenmark/gatsby-starter-level-2.git
To get started all you have to do is run the following command:
npm start
Now that you have a copy of your fork, there is work you will need to do to keep it current.
Do this prior to every time you create a branch for a PR:
- Make sure you are on the
master
branch
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
If your aren't on master
, stash or resolve outstanding files / commits and checkout the master
branch
$ git checkout master
- Do a pull with rebase against
upstream
$ git pull --rebase upstream master
This will pull down all of the changes to the official master branch, without making an additional commit in your local repo.
- (Optional) Force push your master master branch to your GitHub fork
$ git push origin master --force
This will overwrite the master branch of your fork.
Before you start working, you will need to create a separate branch specific to the issue / feature you're working on. You will push your work to this branch.
Name the branch preferably like with the following prefixes and in kebab-case
bugfix/xxx
for bugfixesfeature/xxx
for features or enhancements
where xxx
is a short description of the changes or feature you are attempting to add.
For example feature/add-pagination
would be a branch where you add the pagination feature.
To create a branch on your local machine (and switch to this branch):
$ git checkout -b [name_of_your_new_branch]
and to push to GitHub:
$ git push origin [name_of_your_new_branch]
If you need more help with branching, take a look at this.
Once you cloned, before you start the application, you first need to install all of the dependencies:
# Install NPM dependencies and Start the dev setup and watchers
npm i && npm start
Now navigate to your browser and open http://localhost:3000. If the app loads, congratulations – you're all set.
Get creative!
A pull request (PR) is a method of submitting proposed changes to the main repository. You will make changes to copies of the files in a personal fork, then apply to have them reviewed.
We suggest to avoid making your changes on your master
branch itself.
It is recommended to make a new branch before editing files.
This is to avoid diverging from the original repository.
There are two methods of creating a pull request:
- Editing files on a local clone (recommended)
- Editing files via the GitHub Interface
This is the recommended method. Read about How to Setup and Maintain a Local Instance.
- Perform the maintenance step of rebasing
master
. - Ensure you are on the
master
branch usinggit status
:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
-
If you are not on master or your working directory is not clean, resolve any outstanding files/commits and checkout master
git checkout master
-
Create a branch off of
master
with git:git checkout -B branch/name-here
Note: Branch naming is important. Use a name likebugfix/short-fix-description
orfeature/short-feature-description
. Review the Contribution Guidelines for more detail. -
Edit your file(s) locally with the editor of your choice
-
Check your
git status
to see unstaged files. -
Add your edited files:
git add path/to/filename.ext
You can also do:git add .
to add all unstaged files. Take care, though, because you can accidentally add files you don't want added. Review yourgit status
first. -
Commit your edits.
-
If you would want to add/remove changes to previous commit, add the files as in Step 5 earlier, and use
git commit --amend
orgit commit --amend --no-edit
(for keeping the same commit message). -
Push your commits to your GitHub Fork:
git push origin branch/name-here
-
Go to Common Steps
Note: Editing via the GitHub Interface is not recommended, since it is not possible to update your fork via GitHub's interface without deleting and recreating your fork.
-
Once the edits have been committed, you will be prompted to create a pull request on your fork's GitHub Page.
-
By default, all pull requests should be against the main repo,
master
branch. -
Submit a pull request from your branch to the
master
branch. -
The title of your PR should be descriptive of your changes and succinctly indicates what is being fixed.
-
In the body of your PR include a more detailed summary of the changes you made and why.
- If the PR is meant to fix an existing bug/issue then, at the end of
your PR's description, append the keyword
closes
and #xxxx (where xxxx is the issue number). Example:closes #1337
. This tells GitHub to close the existing issue, if the PR is merged.
- If the PR is meant to fix an existing bug/issue then, at the end of
your PR's description, append the keyword
-
Indicate if you have tested on a local copy of the site or not.
If an Contributor QA's a pull request and confirms that the new code does what it is supposed without seeming to introduce any new bugs, they will comment on it and merge it.
Once your PR is accepted, you may delete the branch you created to submit it. This keeps your working fork clean.
You can do this with a press of a button on the GitHub PR interface. You can
delete the local copy of the branch with: git branch -D branch/to-delete-name
Don't worry! You will receive feedback from the Contributors as to why it was rejected and what changes are required.
Many Pull Requests, especially first Pull Requests, require correction or updating. If you have used the GitHub interface to create your PR, you will need to close your PR, create a new branch, and re-submit.
If you have a local copy of the repo, you can make the requested changes and
amend your commit with: git commit --amend
This will update your existing
commit. When you push it to your fork you will need to do a force push to
overwrite your old commit: git push --force
Be sure to post in the PR conversation that you have made the requested changes.