Free Code Camp Pull Request
What is a Pull Request?
A pull request (PR) is a method of submitting proposed changes to the Free Code Camp Repo (or any Repo, for that matter). You will make changes to copies of the files which make up Free Code Camp in a personal fork, then apply to have them accepted by Free Code Camp proper.
Free Code Camp Issue Mods and staff are on hand to assist with Pull Request related issues on our Help Contributors Chat Room.
There are two methods of creating a Pull for Free Code Camp:
- Editing files via the GitHub Interface
- Editing files on a local clone
Important: ALWAYS EDIT ON A BRANCH
Take away only one thing from this document, it should be this: 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.
Editing via your Local Fork (Recommended)
This is the recommended method. Read about How to Setup and Maintain a Local Instance of Free Code Camp.
- Perform the maintenance step of rebasing
- Ensure you are on the
$ git status
On branch staging
Your branch is up-to-date with ‘origin/staging’.
nothing to commit, working directory clean
- If you are not on staging or your working directory is not clean, resolve any outstanding files/commits and checkout staging
git checkout staging
- Create a branch off of
git checkout -B branch/name-hereNote: Branch naming is important. Use a name like
feature/short-feature-descriptionReview the Contribution Guidelines for more detail.
- Edit your file(s) locally with the editor of your choice
- Check your
git statusto see unstaged files.
- Add your edited files:
git add path/to/filename.extYou can also do:
git add .to add all unstaged files. Take care, though, because you can accidentially add files you don’t want added. Review your
- Commit your edits:
git commit -m "Brief Description of Commit"
- Squash your commits, if there are more than one.
- Push your commits to your GitHub Fork:
git push -u origin branch/name-here
- Go to Common Steps
Editing via the GitHub Interface
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.
- Create a Fork of the FCC Repo
Create a branch within your fork. Note: Branch naming is important. Use a name like
feature/short-feature-descriptionReview the Contribution Guidelinesfor more detail.
- Edit the file and commit the changes.
- Continue to Common Steps.
- 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 FCC main repo,
- Make a clear title for your PR which succinctly indicates what is being fixed. Do not add the issue number in the title. Examples:
Add Test Cases to Algorithm Drop It
Correct typo in Challenge Size Your Images
- In the body of your PR include a more detailed summary of the changes you made and why.
- Indicate if you have tested on a local copy of the site or not.
- If your PR is due to an issue, you can reference and close that issue automatically by adding a keyword like
Closes #xxxx, where
xxxxis the issue number.
If Changes are Requested
Don’t worry, many PRs, especially first PRs, 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. This is because you cannot squash your commits via the GitHub interface.
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.
If your PR is accepted
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
If your PR is rejected
Don’t despair! You should receive solid feedback from the Issue Moderators as to why it was rejected and what is needed. Please, keep contributing.