10

On a Github project, I see a guy made a pull request in Pull Requests section, but I find he made many mistakes so his code need to be corrected. Instead of asking him to change his code, is it possible to do it by myself (that is, I want to correct his code by myself)? and how?

I'm also a member of that project, and I'm new :)

5
  • 2
    Why are you asking us and not the other members of that project?
    – Ken White
    Aug 21, 2016 at 5:45
  • 1
    Why not get him to change the code - so at least he learns. Also you want to make changes in another persons name - this seems rather odd
    – Ed Heal
    Aug 21, 2016 at 5:46
  • Strictly speaking, I'm not changing his programming code, I'm changing his language (Japanese) in his code. It's much simpler to change by myself because it's a little hard to communicate with him, in Japanese, or in English (Neither is his native language).
    – shintaroid
    Aug 21, 2016 at 6:00
  • @KenWhite he question is correct. The question "is it possible to change?" not "should I do that?" I'm also very interesting, since got a lot of PR's from contributors in my projects, and I don't want to wait for minor fixes. Still, I can't simply push to their PR.
    – skywinder
    Dec 24, 2019 at 5:31
  • @skywinder: No, is it possible is not a question, because that's too vague and broad in scope.. Of course it's possible. The question is whether it's appropriate, and that would depend on the project's guidelines about how it is used and whether they accept commits from new members of the project without review, neither of which is answerable by SO members. (And you are aware that you're posting your comment to a 3 1/2 year old comment of mine, right?)
    – Ken White
    Dec 24, 2019 at 13:20

2 Answers 2

6

Enabling repository maintainer permissions on existing pull requests

Pull request creators can give these permissions on each of their pull requests when they initially create a pull request from a fork or after they have created the pull request.

  • On GitHub, navigate to the main page of the upstream repository of your pull request.
  • In the list of pull requests, navigate to the pull request that you'd like to allow commits on.
  • In the right sidebar of your pull request, select Allow edits from maintainers. You can change these permissions at any time by unselecting this option.

More details on github help page: Allowing changes to a pull request branch created from a fork


TL;DR

Author of PR can modify an existing pull request to let repository maintainers make commits to your branch.

In order to allow you to make commits to others PR - the author has to set checkbox from the left: enter image description here

1
  • 4
    How do I see if pull requester has enabled the checkbox? I want to edit his patch.
    – Nakilon
    Jun 2, 2021 at 23:55
4

Assuming the original author is responsive enough, it’s always better to ask them to fix it (unless the change is an obvious typo fix, maybe). They might have a reason for writing it the way they did.

If the author isn’t responsive and you’re deciding whether to fix it in place or with a new commit, ask yourself which way the history reads more clearly. If the commit would introduce a regression, you should probably fix it in place (to avoid breaking bisectability). If it handles some cases and you just want to add more cases without significantly changing the existing code, it might be better to add a new commit.

If you do amend the existing commit in any way, make sure to leave a note in the commit message explaining what you changed. One typical style is to leave a note in square brackets, grouped with any Signed-off-by: lines (if applicable): [[email protected]: Refactor new cases into a function for clarity] For example: linux.git commit b44129b3.

via https://www.quora.com/GitHub-Is-it-bad-etiquette-to-change-someones-pull-request-before-committing

1
  • 1
    your answer should say : only if you can push to the branch the PR is for! :)
    – Daij-Djan
    Dec 21, 2019 at 0:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.