After posting about my first Git/Hub workflow experiences, I got lots of helpful input from various folks, particularly Erik Vold, Irakli Gozalishvili, and Brian Warner, which led me to refine my process for handling pull requests:
- From the “how to merge this pull request” section of the pull request page (f.e. pull request 34), copy the command from step two, but change the word “pull” to “fetch” to fetch the remote branch containing the changes without also merging it:
git fetch <a href="https://github.com/toolness/jetpack-sdk.git">https://github.com/toolness/jetpack-sdk.git</a> bug-610507<br /><br />
- Use the magic FETCH_HEAD reference to the last fetched branch to verify that the set of changes is what you expect:
git diff HEAD FETCH_HEAD
(The exact syntax here may need some work; HEAD..FETCH_HEAD? three dots?)
- Merge the remote branch into your local branch with a custom commit message:
git merge FETCH_HEAD --no-ff -m"bug 610507: get rid of the nsjetpack package; r=myk"
- Push the changes upstream:
git push upstream master
I like this set of commands because it doesn’t require me to add a remote, I can copy/paste the fetch command from GitHub (being careful not to issue the pull before I change it to a fetch), and I always type the same FETCH_HEAD reference to the remote branch in step three.
However, I wish the merge commit page explicitly referenced the specific commits that were merged. It does mention that it’s a branch merge, it isn’t obvious how to get from that page to the pages for the commits I merged from the branch.
“git log --oneline --graph“, gitg, and gitk do give me that information, though, so I’m ok on the command line, anyway.
[More discussion can be found in the discussion group thread.]