This is an automated email from the ASF dual-hosted git repository. dashorst pushed a commit to branch contribute-wicket-code in repository https://gitbox.apache.org/repos/asf/wicket-site.git
commit 46978052c80064587168dba7bec98eb0695148b1 Author: Martijn Dashorst <[email protected]> AuthorDate: Thu Nov 19 17:08:49 2026 +0100 Ask for clean pull requests instead of never rewriting a branch The contributor pages said that pushed commits are never rewritten, that review comments are fixed with new commits, and that pull requests are merged with a merge commit. That holds for apache/wicket's own branches, which refuse force pushes, but not for a pull request branch in a contributor's fork, and the repository allows merge, squash and rebase merges. It would leave "review comments" commits in master. The pages now follow CONTRIBUTING.md (apache/wicket 50542ea5c2): focused commits, review fixes as separate commits during the review and squashed into the commit they belong to before the merge, and the committer who merges says who squashes. A pull request branch can be updated from master by a rebase or a merge, whichever the committer asks for, and a cleaned-up branch is pushed with a lease. The explanation of why master comes first keeps the section on history, now only about Wicket's own branches and the cherry-picks that refer to commits on master. Co-Authored-By: Claude Opus 5.5 <[email protected]> --- _contribute/wicket-conventions.md | 4 +++- _contribute/wicket-master-first.md | 6 ++++-- _contribute/wicket-pull-request.md | 22 +++++++++++++++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/_contribute/wicket-conventions.md b/_contribute/wicket-conventions.md index 285e69c2..e6227e1f 100644 --- a/_contribute/wicket-conventions.md +++ b/_contribute/wicket-conventions.md @@ -61,7 +61,9 @@ The build checks the order in every `pom.xml`: sections in the standard Maven or | Issue | `GitHub issue #<number>` on a line of its own; a Jira key such as `WICKET-7165` for an issue from Jira. | | Tools | `Generated-by: <name of tool> <version>` when a generative AI tool wrote part of the change, as the [ASF asks](https://www.apache.org/legal/generative-tooling.html). | -A commit that is already pushed is not changed: no amend, rebase or force-push. Correct it with a new commit, and bring a branch up to date by merging `master` into it. +Keep commits focused: one logical change per commit, and never formatting mixed with a fix. No "WIP", "fix stuff" or "review comments" commit is left in a pull request when it is merged. During the review you may push fixes as separate commits; before the merge they are squashed into the commit they belong to. The committer who merges your pull request tells you whether to squash yourself or whether they squash when merging. + +Never force-push to a branch in apache/wicket itself; the repository refuses it. Force-pushing your own pull request branch to clean it up is fine. ## Security diff --git a/_contribute/wicket-master-first.md b/_contribute/wicket-master-first.md index 2f56b858..201632f6 100644 --- a/_contribute/wicket-master-first.md +++ b/_contribute/wicket-master-first.md @@ -27,6 +27,8 @@ Whether a fix goes to the older lines is a decision, not a rule. A fix that chan So you send one pull request, against `master`, and say in the issue which versions have the bug. The committers decide which lines get the fix, and cherry-pick it after the merge. -## History that is not rewritten +## Wicket's branches are never rewritten -Pull requests are merged with a merge commit, and commits that are pushed are never changed. A cherry-pick refers to a commit on `master`; reviewers refer to the commits they have read. A rebase or force-push changes those commits into new ones, and the references point to nothing. That is why a branch in review is brought up to date by merging `master` into it, and a mistake is corrected with a new commit on top. Wicket's own branches refuse force pushes. +Once a commit is on `master` or a release branch, it does not change. A cherry-pick to an older branch is a new commit that often records the commit on `master` it came from, as `cherry picked from commit …` in its message, and issues and pull requests link to commits too. Rewriting `master` would turn those commits into new ones, and every reference would point to nothing. So the branches of apache/wicket refuse force pushes: `master`, the `wicket-*.x` release branches, and the `release [...] + +This holds for Wicket's own branches, not for the branch of a pull request in your fork. Until it is merged, you can clean that branch up and force-push it, as [Send a pull request to Wicket]({{ site.baseurl }}/contribute/wicket-pull-request.html#9-work-with-the-review) describes. diff --git a/_contribute/wicket-pull-request.md b/_contribute/wicket-pull-request.md index 1c70e950..d987eb41 100644 --- a/_contribute/wicket-pull-request.md +++ b/_contribute/wicket-pull-request.md @@ -137,7 +137,27 @@ GitHub runs the same full build on several JDKs; the result shows at the bottom A reviewer comments on the pull request. Committers are volunteers, so a review can take a few days. If nothing happens for a week, ask for a review in a comment or on the [developers list]({{ site.baseurl }}/community/#dev). -To answer a review, commit on the same branch and push again; the pull request updates itself. Do not rebase, amend or force-push a branch that is already in review: the reviewers have read your earlier commits, and [history is not rewritten]({{ site.baseurl }}/contribute/wicket-master-first.html#history-that-is-not-rewritten). To bring the branch up to date with `master`, merge it: +To answer a review, commit the changes on the same branch and push again; the pull request updates itself. Separate commits for review comments are fine while the review lasts, so that the reviewer sees what changed. They do not stay: before the merge, each is squashed into the commit it belongs to, so that `master` gets no "review comments" commits. The committer who merges tells you whether to do that yourself or whether they squash when merging. + +To squash yourself, start an interactive rebase, mark each review commit as `fixup` and move it below the commit it belongs to, and force-push your branch: + +```shell +git fetch upstream +git rebase -i upstream/master +git push --force-with-lease --force-if-includes origin keep-url-fragment +``` + +Force-pushing is fine for your own pull request branch; only the branches of apache/wicket refuse it. `--force-with-lease --force-if-includes` refuses to overwrite commits on your fork that you have not seen, for example ones you pushed from another computer. + +When the committer asks you to bring the branch up to date with `master`, rebase it or merge `master` into it, whichever they ask for. To rebase: + +```shell +git fetch upstream +git rebase upstream/master +git push --force-with-lease --force-if-includes origin keep-url-fragment +``` + +To merge: ```shell git fetch upstream
