pyrookie
pyrookie

Reputation: 400

updating github pull request

Can I modify someone's pull request to my repository and add these modifications to that pull request?

Say A forked my repo, added a feature branch, and made a pull request on my repo. I want to make some changes to the pull request, and not necessarily merge it yet, but update the pull request. Is this possible?

Upvotes: 0

Views: 385

Answers (1)

aspiring_sarge
aspiring_sarge

Reputation: 2485

Long answer short: No. Not unless you have permission to edit that person's fork. You can, however, pull in the person's commits and work on top of them as shown below. Note that this will not modify the PR, but only enable you to keep the person's commits.

You could create a new branch. Then point a remote to the branch on which A submitted the PR, pull in changes from A's branch and then work on those changes.

Steps: Assume A's fork lies at https://github.com/repo/A.git and A's branch name is <A's_branch_name>.

  1. Create a new branch on Github (say aBranch).
  2. Run a git pull to pull in the branch.
  3. Change to the new branch using
    git checkout aBranch.
  4. Create a remote pointing to A's branch using
    git remote add aBranchRemote https://github.com/repo/A.git.
  5. Pull in A's changes with a
    git merge aBranchRemote <A's_branch_name>

PS: I've not tested these steps, but it should work fine. I faced a very similar situation yesterday, and this worked.

Upvotes: 1

Related Questions