Updated How to properly submit a PR (markdown)

This commit is contained in:
Blaž Kristan 2024-01-30 07:53:15 +01:00
parent 2238c6b413
commit 4eac233865
1 changed files with 12 additions and 5 deletions

View File

@ -5,15 +5,15 @@ If you plan to submit a PR bigger than a simple change in one file, here is a sh
* Fork the WLED repository in Github (by clicking the "Fork" button in the upper-right corner of GitHub)
* Clone your repository locally via `git clone https://github.com/<github_user>/WLED.git` (replacing `<github_user>` with your GitHub Username) and work on your local copy
* Add the upstream repository via `git remote add upstream https://github.com/Aircoookie/WLED.git`
* Ensure you are on the `master` branch via `git checkout master`
* Ensure you are on the `main` branch via `git checkout main` (alternatively you may want to check out a *specific* branch if instructed so, usually it will be a branch for the next WLED version or any other active branch)
* Create and change to a new branch via `git checkout -b <temp_branch>` (replacing `<temp_branch>` with the name you want to use for your temporary branch) to create a working branch where you can push commits
* Set the upstream branch via `git push --set-upstream origin <temp_branch>` (replacing `<temp_branch>` with the name you used in the previous step)
* Work on your local version and push as many commits as you want
When you think it is ready to merge and submit a PR:
* Return to the `master` branch via `git checkout master`. This will not erase any committed changes you have made.
* Ensure your `master` branch is up-to-date with the latest changes via `git pull upstream master`
* Return to the `main` branch via `git checkout main` (or the *specific* branch you selected 1st). This will not erase any committed changes you have made.
* Ensure your `main` branch is up-to-date with the latest changes via `git pull upstream main` (alternatively replace `main` with *specific* branch)
* Update your fork of WLED by running `git push`
* Create a new branch to be used for your PR via `git checkout -b <pr_branch>` (replacing `<pr_branch>` with a new branch name, which must be different from `<temp_branch>`)
* Set the upstream branch via `git push --set-upstream origin <pr_branch>` (replacing `<pr_branch>` with the name you used in the previous step)
@ -24,7 +24,7 @@ Now you have a clean single commit from which you can create the PR on the WLED
## 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.
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:
@ -80,4 +80,11 @@ You already know how to do this. :smiley:
![Options when only Squash and Merge enabled](https://user-images.githubusercontent.com/146967/85749445-b762c880-b6bd-11ea-89d7-6b88595ffa55.png)
</details>
</details>
## Updating a PR
When you receive a feedback requesting modifications to your PR, you can easily do them in the branch used for PR.
Before making any local changes make sure you update your local copy by issuing `git checkout <pr_branch>` followed by `git pull`. This will make sure your local copy received any available updates from the PR. Once you make and commit changes just push them to your repository using `git push`. PR will be updated automatically.
If you encounter conflicts you need to resolve those locally (by pulling, modifying and committing) before pushing it upstream. **Never** force push your changes, it messes the commit history and prevents collaboration on PR.