Provide alternatives for those preferring GitHub UI

This commit is contained in:
Henry Gabryjelski 2021-07-25 02:28:01 -07:00
parent 0b90e7047f
commit 591a2c717f
1 changed files with 61 additions and 1 deletions

View File

@ -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 <temp_branch>` (replacing `<temp_branch>` with the branch name you used earlier) * Merge the edits but be sure to remove the history of your local commits via `git merge --squash <temp_branch>` (replacing `<temp_branch>` with the branch name you used earlier)
* Create a new commit containing all of your merged changes via `git commit -m "<Message>"` (replacing `<Message>` with information regarding the contents of your changes) * Create a new commit containing all of your merged changes via `git commit -m "<Message>"` (replacing `<Message>` 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 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'._
<details><summary>1. Ensure your fork's main branch is up-to-date with the upstream depot</summary><P/>
* 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"
</details>
<details><summary>2. Create a new branch based off your main branch</summary><P/>
* 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
</details>
<details><summary>3. Create a PR to this new branch</summary><P/>
* 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...
</details>
<details><summary>4. Approve your own PR, but select the option "Squash and Merge"</summary><P/>
* 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`
</details>
<details><summary>5. Create a NEW PR from this NEW branch</summary><P/>
You already know how to do this. :smiley:
</details>
<details><summary>Picture showing where admins only enable `Squash and merge` for depot</summary><P/>
![Options when only Squash and Merge enabled](https://user-images.githubusercontent.com/146967/85749445-b762c880-b6bd-11ea-89d7-6b88595ffa55.png)
</details>