Feedback, bug reports, and pull requests are welcome.
Feel free to ask for help. You can reach me on Twitter @Christoph_Herr or in the GenesisWP Slack group, username christophherr.
Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub
This guide has been modified from freeCodeCamp's Contributors Guide
- Install Git or your favorite Git client.
- (Optional) Setup an SSH Key for GitHub.
- Go to the top level prometheus repository: https://github.com/christophherr/prometheus
- 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 prometheus repo at https://github.com/yourUsername/prometheus
- Open a Terminal / Command Line / Bash Shell in your project's directory (i.e.:
/yourprojectdirectory/
) - Clone your fork of prometheus
$ git clone https://github.com/yourUsername/prometheus.git
(make sure to replace yourUsername
with your GitHub username)
This will download the entire prometheus repo to your project's directory.
- Change directory to the new prometheus directory (
cd prometheus
) - Add a remote to the original prometheus repo:
$ git remote add upstream https://github.com/christophherr/prometheus.git
Congratulations, you now have a local copy of the prometheus repo!
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
staging
branch
$ git status
On branch staging
Your branch is up-to-date with 'origin/develop'.
If your aren't on develop
, resolve outstanding files / commits and checkout the develop
branch
$ git checkout develop
- Do a pull with rebase against
develop
$ git pull --rebase upstream develop
This will pull down all of the changes to the official staging branch, without making an additional commit in your local repo.
- (Optional) Force push your updated develop branch to your GitHub fork
$ git push origin develop --force
This will overwrite the develop branch of your fork.
You don't necessarily need to use --rebase
or --force
.
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.
There several strategies for naming branches.
You could name the branch something like fix/xxx
or feature/xxx
where xxx
is a short description of the changes or
feature you are attempting to add. For example fix/email-login
would be a branch where you fix something specific to email login.
I'd recommend to name it something that makes sense for what you are working on.
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.
If you have composer installed on your machine, please run composer install
on the root of your develop
branch.
After the installation finishes, you can run PHPCS over the code with the command composer phpcs
.
If you don't have composer, you can go to (https://getcomposer.org/doc/00-intro.md)[https://getcomposer.org/doc/00-intro.md] and follow the steps to install it.
When you open a pull request, Travis CI will run PHPCS over your code and let me know if there are any errors.
A pull request (PR) is a method of submitting proposed changes to the prometheus repo (or any repo, for that matter). You will make changes to copies of the files in a personal fork, then apply to have them accepted by the original repo.
Feel free to ask for help. You can reach me on Twitter @Christoph_Herr or in the GenesisWP Slack group, username christophherr.
Take away only one thing from this document: Never, EVER
make edits to the staging
branch. ALWAYS make a new branch BEFORE you edit
files. This is critical, because if your PR is not accepted, your copy of
staging will be forever sullied and the only way to fix it is to delete your
fork and re-fork.
There are two methods of creating a pull request for prometheus:
- 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
staging
. -
Ensure you are on the
staging
branch usinggit status
:$ git status On branch staging Your branch is up-to-date with 'origin/develop'. nothing to commit, working directory clean
-
If you are not on develop or your working directory is not clean, resolve any outstanding files/commits and checkout develop
git checkout develop
-
Create a branch off of
develop
with git:git checkout -b branch/name-here
-
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.
git commit -m "your-commit-message"
Please make sure to write a commit message that summarizes the changes.
If you find yourself in the need to use and
it might be better to do two separate commits.
See (Writing good commit messages)[https://github.com/copyblogger/genesis/wiki/Writing-good-commit-messages] for inspiration.
As a note, I started my commit messages in the past tense. Added
instead of Add
.
-
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
-
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 prometheus main repo,
develop
branch. Make sure that your Base Fork is set to prometheus/develop when raising a Pull Request. -
Submit a pull request from your branch to prometheus's
develop
branch. -
The title (also called the subject) of your PR should be descriptive of your changes and succinctly indicate what is being fixed.
-
Do not add the issue number in the PR title or commit message.
-
Examples:
Added missing CSS classes
Fixed typo in readme.md
-
-
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 your local copy or not.
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 despair! You should receive solid feedback as to why it was rejected and what changes are needed.
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, commit them and push them to your fork.
Be sure to post in the PR conversation that you have made the requested changes.