0

Let's I have two commits in a pull request; one is a descendant of another. For example;

(descendant)

https://github.com/common-workflow-language/cwltool/commit/a42ef0604e1957c8c91fde26a2f939444df5009b

(parent)

https://github.com/common-workflow-language/cwltool/pull/64/commits/e2231e1d1eabffa68bcfdc2e0fbe2419a7204b07

How would one go about merging the descendant into the pull request? Presumably I have to do something like pull the descendant into the parent and then re-commit? I can't seem to get this working. I've tried various approaches (i.e. cherry picking), and can't seem to do it right. I appreciate your help and expertise.

2
  • Both of those links point to the same commit...
    – Ajedi32
    Commented Apr 15, 2016 at 14:14
  • 1
    When you say pull request, do you mean branch? A pull request is a github resource. It's basically saying, "I want to merge branch A into branch B". Pushing another commit to branch A will automatically make it show up on the github pull request, but it doesn't sound like that's what you're asking. Commented Apr 15, 2016 at 14:38

1 Answer 1

2

A pull request is just a request to merge one branch into another. You can update a pull request at any time by changing the commit the source branch for that PR is pointing to. So to merge the "descendant" pull request into its parent, just merge the source branch for the descendant pull request into the source branch for the parent PR.

E.g. if you have pr1, the source branch for the parent PR, and pr2, the branch for the descendant PR:

Commit graph with pr1 and pr2

Just checkout pr1, run git merge pr2, then push with git push origin pr1:

After merge and push

That should update the PR in GitHub. Try it out in Learn Git Branching!

1
  • This is incredible Ajedi32. Thank you. I believe you are correct. This was eventually achieved by a technique similar to what you specified. The commands used to add and execute the push (from local working copy) were as follows (for this cherry-pick was used as opposed to a merge). gist.github.com/anonymous/4814221a475216abf5b3b478e14c5f6c
    – a2f0
    Commented Apr 15, 2016 at 16:43

Your Answer

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

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