|
| 1 | +# TLTR: Create a Pull Request |
| 2 | + |
| 3 | +1. Fork this repository. |
| 4 | +2. Clone your new repository to your system. |
| 5 | +3. Create a new branch (i.e. `type/issue-<id>-very-short-issue-name`) from branch `develop`. |
| 6 | +4. Commit changes and push the new branch. |
| 7 | +5. Open and submit a PR. |
| 8 | + |
| 9 | +If you have never opened a PR and need direction, read more below. |
| 10 | + |
| 11 | +# Contributor's Guide |
| 12 | + |
| 13 | +Feedback, bug reports, and pull requests are welcome. Feel free to ask for [help](https://github.com/dhruvilrathod/Angular-Master-Portfolio/issues). |
| 14 | + |
| 15 | +Working on your first Pull Request? You can learn how from this _free_ series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github) |
| 16 | + |
| 17 | +This guide has been modified from [freeCodeCamp's Contributors Guide](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md) |
| 18 | + |
| 19 | +## Forking the Project |
| 20 | + |
| 21 | +### Setting Up Your System |
| 22 | + |
| 23 | +1. Install [Git](https://git-scm.com) or your favorite Git client. |
| 24 | +2. (Optional) [Setup an SSH Key](https://help.github.com/articles/generating-an-ssh-key) for GitHub. |
| 25 | + |
| 26 | +### Forking Angular Master Portfolio |
| 27 | + |
| 28 | +1. Go to the top-level page of this [repository](https://github.com/dhruvilrathod/Angular-Master-Portfolio) |
| 29 | +2. Click the "Fork" button in the upper right-hand corner of the interface ([More Details Here](https://help.github.com/articles/fork-a-repo)) |
| 30 | +3. After the repository (repo) has been forked, you will be taken to your copy of the Angular Master Portfolio repo at <https://github.com/yourUsername/Angular-Master-Portfolio> |
| 31 | + |
| 32 | +### Cloning Your Fork |
| 33 | + |
| 34 | +1. Open a Terminal / Command Line / Bash Shell in your project's directory (_i.e.: `/yourprojectdirectory/`_) |
| 35 | +2. Clone your fork of `Angular Master Portfolio` |
| 36 | + |
| 37 | +```shell |
| 38 | +git clone https://github.com/yourUsername/Angular-Master-Portfolio.git |
| 39 | +``` |
| 40 | + |
| 41 | +**(make sure to replace `yourUsername` with your GitHub username)** |
| 42 | + |
| 43 | +This will download the entire `Angular Master Portfolio` repo to your project's directory. |
| 44 | + |
| 45 | +### Setup Your Upstream |
| 46 | + |
| 47 | +1. Change directory to the new directory (`cd ./Angular-Master-Portfolio`) |
| 48 | +2. Add a remote to the original `Angular Master Portfolio` repo: |
| 49 | + |
| 50 | +```shell |
| 51 | +git remote add upstream https://github.com/dhruvilrathod/Angular-Master-Portfolio.git |
| 52 | +``` |
| 53 | + |
| 54 | +Congratulations, you now have a local copy of the `Angular Master Portfolio` repo! |
| 55 | + |
| 56 | +### Create a Branch |
| 57 | + |
| 58 | +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. |
| 59 | + |
| 60 | +#### Naming Your Branch |
| 61 | + |
| 62 | +There are several strategies for naming branches. |
| 63 | + |
| 64 | +You could name the branch something like `fix/issue-<id>-xxx` or `feature/issue-<id>-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. |
| 65 | + |
| 66 | +Your branch must be created from branch `develop` |
| 67 | + |
| 68 | +### Syncing `develop` branch |
| 69 | +If you don’t have a develop branch locally yet, you can create it by checking it out from the upstream develop branch: |
| 70 | +``` |
| 71 | +git checkout -b develop upstream/develop |
| 72 | +``` |
| 73 | +If you already have a develop branch, just switch to it: |
| 74 | +``` |
| 75 | +git checkout develop |
| 76 | +``` |
| 77 | +Fetch the latest changes for develop from the upstream: |
| 78 | +``` |
| 79 | +git fetch upstream |
| 80 | +``` |
| 81 | +Rebase your local develop branch with the upstream develop branch: |
| 82 | +``` |
| 83 | +git pull --rebase upstream develop |
| 84 | +``` |
| 85 | + |
| 86 | +#### Adding Your Branch |
| 87 | + |
| 88 | +To create a branch on your local machine (and switch to this branch): |
| 89 | + |
| 90 | +```shell |
| 91 | +git checkout -b [branch-name] |
| 92 | +``` |
| 93 | + |
| 94 | +and to push to GitHub: |
| 95 | + |
| 96 | +```shell |
| 97 | +git push origin [branch-name] |
| 98 | +``` |
| 99 | + |
| 100 | +**If you need more help with branching, take a look at [this](https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches).** |
| 101 | + |
| 102 | +### Creating a Pull Request |
| 103 | + |
| 104 | +#### What is a Pull Request? |
| 105 | + |
| 106 | +A pull request (PR) is a method of submitting your new site to the `Angular Master Portfolio` (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. |
| 107 | + |
| 108 | +#### Need Help? |
| 109 | + |
| 110 | +Feel free to ask for [help](https://github.com/dhruvilrathod/Angular-Master-Portfolio/issues), we are here to help. |
| 111 | + |
| 112 | +#### Important: ALWAYS EDIT ON A BRANCH |
| 113 | + |
| 114 | +Take away only one thing from this document: Never, **EVER** make edits to the `develop` or `master` branches. 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. |
| 115 | + |
| 116 | +#### Methods |
| 117 | + |
| 118 | +There are two methods of creating a pull request for 'Angular Master Portfolio': |
| 119 | + |
| 120 | +- Editing files on a local clone (recommended) |
| 121 | +- Editing files via the GitHub Interface |
| 122 | + |
| 123 | +##### Method 1: Editing via your Local Fork _(Recommended)_ |
| 124 | + |
| 125 | +This is the recommended method. Read about [How to Setup and Maintain a Local Instance](#maintaining-your-fork). |
| 126 | + |
| 127 | +1. Perform the maintenance step of rebasing `master`. |
| 128 | +2. Ensure you are on the `master` branch using `git status`: |
| 129 | + |
| 130 | + $ git status |
| 131 | + On branch master |
| 132 | + Your branch is up-to-date with 'origin/master'. |
| 133 | + |
| 134 | + nothing to commit, working directory clean |
| 135 | + |
| 136 | +3. If you are not on `master` or your working directory is not clean, resolve any outstanding files/commits and checkout `git checkout master` |
| 137 | + |
| 138 | +4. Create a branch off of `develop`. |
| 139 | + |
| 140 | +5. Edit your file(s) locally with the editor of your choice. |
| 141 | + |
| 142 | +6. Check your `git status` to see unstaged files. |
| 143 | + |
| 144 | +7. 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 to be added. Review your `git status` first. |
| 145 | + |
| 146 | +8. Resolve any merge conflicts before commiting. |
| 147 | + |
| 148 | +9. Commit your edits. `git commit -m "your-commit-message"` |
| 149 | + |
| 150 | +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. |
| 151 | + |
| 152 | +See [Useful Tips for writing better Git commit messages](https://code.likeagirl.io/useful-tips-for-writing-better-git-commit-messages-808770609503) for inspiration. |
| 153 | + |
| 154 | +As a note, use the present tense for your commit messages (i.e. `Add` instead of `Added`). |
| 155 | + |
| 156 | +10. If you would want to add/remove changes to the previous commit, add the files as in Step 5 earlier, and use `git commit --amend` or `git commit --amend --no-edit` (for keeping the same commit message). |
| 157 | + |
| 158 | +11. Push your commits to your GitHub Fork: `git push origin [branch-name]` |
| 159 | + |
| 160 | +12. Once the edits have been committed, you will be prompted to create a pull request on your fork's GitHub Page. |
| 161 | + |
| 162 | +13. By default, all pull requests should be against the `Angular Master Portfolio` main repo, `develop` branch. |
| 163 | + **Make sure that your Base Fork is set to Angular-Master-Portfolio/master when raising a Pull Request.** |
| 164 | + |
| 165 | +14. Submit a pull request from your branch to the `Angular Master Portfolio`'s `develop` branch. |
| 166 | + |
| 167 | +15. The title (also called the subject) of your PR should be descriptive of your changes and succinctly indicate what is being fixed. |
| 168 | + |
| 169 | +### Next Steps |
| 170 | + |
| 171 | +#### If your PR is accepted |
| 172 | + |
| 173 | +Once your PR is accepted, you may delete the branch you created to submit it. This keeps your working fork clean. |
| 174 | + |
| 175 | +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` |
| 176 | + |
| 177 | +#### If your PR comes back |
| 178 | + |
| 179 | +Don't despair! You are probably being asked to make a formatting change. If you have a local copy of the repo, you can make the requested changes, commit them and push them to your fork. |
0 commit comments