Editing a contributor’s GitHub PR when Allow edits from maintainers is enabled

June 25, 2026

Sometimes someone opens a pull request against your repository with the right idea and just a few rough edges. The quickest way to finish it may be for a maintainer to add a commit directly to the PR’s head branch, saving another round trip with the author.

The author must have checked Allow edits from maintainers on the PR. This option lets people with write access to the target repository push commits to the source branch on the contributor’s fork.

Here is the workflow I used.

Scenario

Suppose:

  • The target repository is S2thend/cursor-history.
  • The PR number is 30.
  • The source fork is caseyjhol/cursor-history.
  • The source branch is feature/fix-migration-session-visibility.
  • The author has enabled Allow edits from maintainers.

The top of the GitHub PR page will usually show something like this:

caseyjhol wants to merge ... into S2thend:main from caseyjhol:feature/fix-migration-session-visibility

Pay particular attention to the second part:

from caseyjhol:feature/fix-migration-session-visibility

That fork and branch are the destination for the push later.

The shortest sequence of commands

First fetch the PR into a temporary local branch:

git fetch https://github.com/S2thend/cursor-history.git pull/30/head:pr-30-review
git switch pr-30-review

Edit the code, test it, and commit as usual:

git status
git add path/to/changed-file
git commit -m "Fix migration session visibility"

Finally, push local HEAD back to the source branch in the contributor’s fork:

git push git@github.com:caseyjhol/cursor-history.git HEAD:feature/fix-migration-session-visibility

This push is the important part. Its destination is the real branch in the author’s fork. pull/30/head is for fetching.

Why are the fetch and push URLs different?

This is the easiest part to mix up.

pull/30/head is a PR ref that GitHub exposes in the target repository. It is convenient for checking out a PR locally for review:

git fetch https://github.com/S2thend/cursor-history.git pull/30/head:pr-30-review

It is not an ordinary branch to push to directly. The branch backing the PR is the head branch in the contributor’s fork:

caseyjhol/cursor-history
feature/fix-migration-session-visibility

That is why the push looks like this:

git push git@github.com:caseyjhol/cursor-history.git HEAD:feature/fix-migration-session-visibility

HEAD:feature/fix-migration-session-visibility means “push the latest commit on my current local branch to the remote feature/fix-migration-session-visibility branch.”

If the local branch already exists

If you previously fetched this PR and already have a local pr-30-review branch, fetching directly might fail. You can use a different local branch name:

git fetch https://github.com/S2thend/cursor-history.git pull/30/head:pr-30-review-2
git switch pr-30-review-2

Alternatively, once you have confirmed you no longer need the old branch, delete it and create it again:

git branch -D pr-30-review
git fetch https://github.com/S2thend/cursor-history.git pull/30/head:pr-30-review
git switch pr-30-review

A more readable remote name

If you do this repeatedly, you can add the contributor’s fork as a temporary remote:

git remote add pr-author git@github.com:caseyjhol/cursor-history.git
git push pr-author HEAD:feature/fix-migration-session-visibility

You can remove it afterward:

git remote remove pr-author

For a one-off PR fix I prefer writing the full push URL directly. It keeps the local remote list tidy and avoids leaving behind a remote I have forgotten was temporary.

Common errors

Permission denied

If the push reports something like:

ERROR: Permission to caseyjhol/cursor-history.git denied

The usual causes are:

  1. The PR author did not check Allow edits from maintainers.
  2. You are not a maintainer of the target repository or do not have write access.
  3. You pushed to the wrong fork.
  4. Your SSH key is not associated with the GitHub account you are using.

First confirm the exact source fork and branch on the PR page, then confirm that the contributor allows maintainer edits.

non-fast-forward

If the contributor pushes a new commit while you are editing locally, your push may fail as a non-fast-forward update.

Do not rush into a force push. Fetch the latest PR first:

git fetch https://github.com/S2thend/cursor-history.git pull/30/head:pr-30-latest

Then rebase your changes or cherry-pick them onto the latest branch and push normally. Avoid force-pushing someone else’s PR branch unless you have explicitly discussed it with the author.

The PR page does not update

If the push succeeds but the PR does not update, you probably pushed to the wrong branch. Check from owner:branch at the top of the PR page against your command:

git push git@github.com:<owner>/<repo>.git HEAD:<branch>

owner and branch must match the source shown on the PR page exactly.

When to use this workflow

Good cases include:

  • The PR is going in the right direction and needs only small fixes.
  • The reason CI failed is clear and the maintainer can fix it quickly.
  • The contributor needs a hand with an unfamiliar project convention.
  • Directly committing the fix costs less than another round of review comments.

Poor fits include:

  • The change would alter the PR’s core design.
  • It requires an extensive rewrite of the contributor’s code.
  • The contributor has not explicitly authorized maintainer edits.
  • You would have to force-push or rewrite history.

In those cases, explain the suggestion on the PR and let the author make the change.

Remember which direction each operation goes

Fetch from the target repository:

git fetch <base-repo-url> pull/<pr-number>/head:<local-branch>

Push to the contributor’s fork:

git push <contributor-fork-url> HEAD:<contributor-branch>

Complete example:

git fetch https://github.com/S2thend/cursor-history.git pull/30/head:pr-30-review
git switch pr-30-review

# edit files...
git add .
git commit -m "Fix migration session visibility"

git push git@github.com:caseyjhol/cursor-history.git HEAD:feature/fix-migration-session-visibility

The principle is simple: fetch the PR ref from the target repository, commit locally, then push back to the actual head branch in the contributor’s fork.

References

  1. GitHub Docs. Allowing changes to a pull request branch created from a fork. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork
  2. GitHub Docs. Committing changes to a pull request branch created from a fork. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/committing-changes-to-a-pull-request-branch-created-from-a-fork
  3. GitHub Docs. Checking out pull requests locally. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

© 2026 borui. All rights reserved. This content may be freely reproduced, displayed, modified, or distributed with proper attribution to borui and a link to the article: borui (2026-06-25). Editing a contributor’s GitHub PR when Allow edits from maintainers is enabled. https://caiborui.com/blog/2026-06-25-zh-github-allow-edits-from-maintainers-pr-entrans

@misc{borui2026-6b0a973d,
  author = {borui},
  title = {{Editing a contributor’s GitHub PR when Allow edits from maintainers is enabled}},
  year = {2026},
  publisher = {borui's blog},
  url = {https://caiborui.com/blog/2026-06-25-zh-github-allow-edits-from-maintainers-pr-entrans}
}