Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Contributing to an existing pull request

Tags:

git

github

I own a repository and someone has submitted a pull request. I want to make some changes to that pull request before bringing it in, is this possible to do?

Note, I'm expecting for my commits to show up in the pull request thread so that the conversation can continuem, etc.

I know that I could go off and clone his fork, and pull in my branch once I have finished but that doen't really fit with the workflow around discussion and improvement.

like image 470
vdh_ant Avatar asked Mar 03 '13 21:03

vdh_ant


3 Answers

GitHub has added an ability to allow users with write permissions to the branch against which the PR is being raised to have write rights to the originating branch.

This is an opt-out feature, i.e.

Only pull request creators can give upstream repository maintainers, or those with push access to the upstream repository, permission to make commits to their pull request's compare branch.

[..]

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.

https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/

Example

Lets use this PR as an example, https://github.com/gajus/table/pull/19.

User epoberezkin created a pull request against gajus:master. The origin of this request is epoberezkin:precompile-schemas. Therefore, as a user with write-permissions to gajus:master I can push to epoberezkin:precompile-schemas branch and these changes will be reflected in the PR, i.e.

git clone [email protected]:gajus/table.git
cd table
git remote add epoberezkin [email protected]:epoberezkin/table.git
git fetch epoberezkin
git checkout epoberezkin/precompile-schemas
# Make changes, commit changes.
git push epoberezkin HEAD:precompile-schemas
like image 126
Gajus Avatar answered Sep 28 '22 10:09

Gajus


If there's an open pull request on a repository that you own, only if you commit to the repository and branch (their repository and their branch) that has the open pull request will that work.

So.. you need to create a pull request to the forker's repo if you want to achieve literally what you've requested - that your commits appear in their pull request

like image 44
AD7six Avatar answered Sep 28 '22 12:09

AD7six


You just need to

  1. download the branch
  2. make changes
  3. commit them
  4. push them

After pushing the changes you will see them in the Github pull request and the workflow will be respected.

like image 42
iberbeu Avatar answered Sep 28 '22 12:09

iberbeu