Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change other people's code in pull requests (Github)?

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 :)

like image 553
shintaroid Avatar asked Aug 21 '16 05:08

shintaroid


2 Answers

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

like image 73
Vladimir Avatar answered Sep 19 '22 00:09

Vladimir


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

like image 34
skywinder Avatar answered Sep 18 '22 00:09

skywinder