Skip to content

Instantly share code, notes, and snippets.

@Ajedi32
Created April 15, 2016 14:46
Show Gist options
  • Save Ajedi32/be6d08de5273c85e0e151769d6891079 to your computer and use it in GitHub Desktop.
Save Ajedi32/be6d08de5273c85e0e151769d6891079 to your computer and use it in GitHub Desktop.
Merging one pull request into another
{
"goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\",\"remoteTrackingBranchID\":\"o/master\"},\"pr1\":{\"target\":\"C3\",\"id\":\"pr1\",\"remoteTrackingBranchID\":\"o/pr1\"},\"pr2\":{\"target\":\"C3\",\"id\":\"pr2\",\"remoteTrackingBranchID\":\"o/pr2\"},\"o/master\":{\"target\":\"C1\",\"id\":\"o/master\",\"remoteTrackingBranchID\":null},\"o/pr1\":{\"target\":\"C3\",\"id\":\"o/pr1\",\"remoteTrackingBranchID\":null},\"o/pr2\":{\"target\":\"C3\",\"id\":\"o/pr2\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"}},\"tags\":{},\"HEAD\":{\"target\":\"pr1\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\",\"remoteTrackingBranchID\":null},\"pr1\":{\"target\":\"C3\",\"id\":\"pr1\",\"remoteTrackingBranchID\":null},\"pr2\":{\"target\":\"C3\",\"id\":\"pr2\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"}},\"tags\":{},\"HEAD\":{\"target\":\"pr2\",\"id\":\"HEAD\"}}}",
"solutionCommand": "git checkout pr1;git merge pr2;git push",
"startTree": "{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\",\"remoteTrackingBranchID\":\"o/master\"},\"pr1\":{\"target\":\"C2\",\"id\":\"pr1\",\"remoteTrackingBranchID\":\"o/pr1\"},\"pr2\":{\"target\":\"C3\",\"id\":\"pr2\",\"remoteTrackingBranchID\":\"o/pr2\"},\"o/master\":{\"target\":\"C1\",\"id\":\"o/master\",\"remoteTrackingBranchID\":null},\"o/pr1\":{\"target\":\"C2\",\"id\":\"o/pr1\",\"remoteTrackingBranchID\":null},\"o/pr2\":{\"target\":\"C3\",\"id\":\"o/pr2\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"}},\"tags\":{},\"HEAD\":{\"target\":\"pr2\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\",\"remoteTrackingBranchID\":null},\"pr1\":{\"target\":\"C2\",\"id\":\"pr1\",\"remoteTrackingBranchID\":null},\"pr2\":{\"target\":\"C3\",\"id\":\"pr2\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"}},\"tags\":{},\"HEAD\":{\"target\":\"pr2\",\"id\":\"HEAD\"}}}",
"name": {
"en_US": "Merge into PR"
},
"hint": {
"en_US": ""
},
"startDialog": {
"en_US": {
"childViews": [
{
"type": "ModalAlert",
"options": {
"markdowns": [
"## Merging into a pull request",
"",
"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 is pointing to."
]
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"## Try it!",
"",
"This is easy to do with git merge:",
"",
"",
""
],
"afterMarkdowns": [
"Notice how `pr1` now includes all the same commits as `pr2`?"
],
"command": "git merge pr2",
"beforeCommand": "git checkout -b pr1;\ngit commit;\ngit checkout -b pr2;\ngit commit;\ngit clone;\ngit checkout pr1;"
}
},
{
"type": "GitDemonstrationView",
"options": {
"beforeMarkdowns": [
"Now you just have to push to the remote to update the pull request on GitHub:",
""
],
"afterMarkdowns": [
"",
"",
""
],
"command": "git push origin pr1",
"beforeCommand": "git checkout -b pr1;\ngit commit;\ngit checkout -b pr2;\ngit commit;\ngit clone;\ngit checkout pr1;\ngit merge pr2;"
}
},
{
"type": "ModalAlert",
"options": {
"markdowns": [
"## Try it!",
"",
"Now try it yourself.",
"",
""
]
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment