diff --git a/How-to-properly-submit-a-PR.md b/How-to-properly-submit-a-PR.md index 06428b4..2d8ffd4 100644 --- a/How-to-properly-submit-a-PR.md +++ b/How-to-properly-submit-a-PR.md @@ -20,4 +20,64 @@ When you think it is ready to merge and submit a PR: * Merge the edits but be sure to remove the history of your local commits via `git merge --squash ` (replacing `` with the branch name you used earlier) * Create a new commit containing all of your merged changes via `git commit -m ""` (replacing `` with information regarding the contents of your changes) -Now you have a clean single commit from which you can create the PR on the WLED Github \ No newline at end of file +Now you have a clean single commit from which you can create the PR on the WLED Github. + +## Alternative + +GitHub provides a drop-down option to apply a PR as a "Squash and Merge", directly from the PR. GitHub even supports [configuring the depot](https://github.com/dotnet/runtime/issues/260#issuecomment-649622840) such that PRs *must* be "Squash and Merge". See picture at end of page. + +However, if you're requested to manually squash and merge **before** the PR is reviewed and approved, you can create a second branch on GitHub and perform the squash and merge entirely via the website: + +_Note: for legacy depots, instead of the branch name 'main', you may see a branch name of 'master'._ + +
1. Ensure your fork's main branch is up-to-date with the upstream depot

+ +* goto your fork of the depot on github.com +* ensure you are viewing the branch 'main' +* select the "fetch upstream" button, then "fetch and merge" + +

+
2. Create a new branch based off your main branch

+ +* goto your fork of the depot on github.com +* ensure you are viewing the branch 'main' +* click on the branch name +* Type a name for your new branch; I'll use the branch name `foo` in this example +* click on the `create branch: foo from 'main'` that appears after you type the name + +

+
3. Create a PR to this new branch

+ +* goto your fork of the depot on github.com +* select the `pull requests` tab (on your fork ... not the upstream depot) +* select `New pull request` button +* the `base repository` will default to the upstream depot; change it to your fork +* _**note the UI is now much simpler :smiley:**_ +* for the `base` branch, select the newly created branch (e.g., `foo`) +* for the `compare` branch, select the old PR branch (e.g., `oldPR`) +* click the resulting `Create pull request` button +* Give the PR a title and a comment +* Click to "submit" the PR to yourself... + +

+
4. Approve your own PR, but select the option "Squash and Merge"

+ +* Scroll down a bit +* Choose the down-triangle on the right side of the `Merge pull request` big green button +* From the drop-down options, select `Squash and merge` +* Now click the big green button that says `Squash and Merge` +* Edit the description as you like ... this will become the commit message +* Click the big green button that says `Confirm squash and merge` + +

+
5. Create a NEW PR from this NEW branch

+ +You already know how to do this. :smiley: + +

+ +
Picture showing where admins only enable `Squash and merge` for depot

+ +![Options when only Squash and Merge enabled](https://user-images.githubusercontent.com/146967/85749445-b762c880-b6bd-11ea-89d7-6b88595ffa55.png) + +

\ No newline at end of file