Part 1: Wherein I Handle My First Pull Request
To fix some test failures, Atul submitted GitHub pull request 33, I reviewed the changes (comprising two commits) on GitHub, and then I pushed them to the canonical repository via the following set of commands:
- git checkout -b toolness-4.0b7-bustage-fixes master
- git pull https://github.com/toolness/jetpack-sdk.git 4.0b7-bustage-fixes
- git checkout master
- git merge toolness-4.0b7-bustage-fixes
- git push upstream master
That landed the two commits in the canonical repository, but it isn't obvious that they were related (i.e. part of the same pull request), that I was the one who reviewed them, or that I was the one who pushed them.
Part 2: Wherein I Handle My Second Pull Request
Thus, for the fix for bug 611042, for which Atul submitted GitHub pull request 34, I again reviewed the changes (also comprising two commits) on GitHub, but then I pushed them to the canonical repository via this different set of commands (after discussion with Atul and Patrick Walton of the Rust team):
- git checkout -b toolness-bug-611042 master
- git pull https://github.com/toolness/jetpack-sdk.git bug-611042
- (There might have been something else here, since the pull request resulted in a merge; I don't quite remember.)
- git checkout master
- git merge --no-ff --no-commit toolness-bug-611042
- git commit --signoff -m "bug 611042: remove request.response.xml for e10s compatibility; r=myk" --author "atul"
- git push upstream master
Because Atul's pull request was no longer against the tip (since I had just merged those previous changes), when I pulled the remote bug-611042 branch into my local toolness-bug-611042 branch (step 2), I had to merge his changes, which resulted in a merge commit.
Merging the changes to my local master with "--no-ff" and "--no-commit" (step 5) then allowed me to commit the merge to my master branch manually (step 6), resulting in another merge commit.
For the second merge commit, I specified "--signoff", which added "Signed-off-by: Myk Melez <m...@mozilla.org>" to the commit message; crafted a custom commit message that included "r=myk"; and specified '--author "atul"', which made Atul the author of the merge.
I dislike having the former merge commit in history, since it's extraneous, unuseful details about how I did the merging locally before I pushed to the canonical repository. I'm not sure how to avoid it, though.
On the other hand, I like having the latter merge commit in history, since it provides context for Atul's two commits: the bug number, the fact that the changes were reviewed, and a commit message that describes the changes as a whole.
I'm ambivalent about --signoff vs. adding "r=myk" to the commit message, as they seem equivalentish, with --signoff being more explicit (so in theory it might form part of an enlightened workflow in the future), while "r=myk" is simpler.
And I dislike having made Atul the author of the merge, since it's incorrect: he wasn't the author of the merge, he was only the author of the changes (for which he is correctly credited). And if the merge itself caused problems (f.e. I accidentally backed out other recent changes in the process), I would be the one responsible for fixing those problems, not Atul.
Part 4: To Bug or Not To Bug?
One of the questions GitHub raises is whether or not every change deserves a bug report. And if not, how do we differentiate those that do from the rest?
I don't have the definitive answers to these questions, but my sense, from my experience so far, is that we shouldn't require all changes to be accompanied by bug reports, but larger, riskier, time-consuming, and/or controversial changes should have reports to capture history, provide a forum for discussion, and permit project planning; while bug reports should be optional for smaller, safer, quickly-resolved, and/or non-controversial changes.
There are a number of ways to "checkout atul's branch" here are the two I've used, there's probably a easier way (there always seems to be):1) - git fetch atul- git checkout -b newBranchName sha1OfTheTipOfAtulsBranch
What you want to do is checkout the commit that atul's branch points to, (if there will be conflicts then I suggest merging your master branch to atul's branch here, handle conflicts, commit, then procede in order to keep the blame correct and the merge to master conflict free) merge that to your master branch and then push your master branch upstream.
> --
> You received this message because you are subscribed to the Google Groups
> "mozilla-labs-jetpack" group.
> To post to this group, send email to mozilla-la...@googlegroups.com.
> To unsubscribe from this group, send email to
> mozilla-labs-jet...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mozilla-labs-jetpack?hl=en.
>
Hi all,
Warning: Git wonkery ahead, with excruciating details. I would not want to read this message. I recommend you skip it. ;-)
Part 1: Wherein I Handle My First Pull Request
To fix some test failures, Atul submitted GitHub pull request 33, I reviewed the changes (comprising two commits) on GitHub, and then I pushed them to the canonical repository via the following set of commands:
- git checkout -b toolness-4.0b7-bustage-fixes master
- git pull https://github.com/toolness/jetpack-sdk.git 4.0b7-bustage-fixes
- git checkout master
- git merge toolness-4.0b7-bustage-fixes
- git push upstream master
That landed the two commits in the canonical repository, but it isn't obvious that they were related (i.e. part of the same pull request), that I was the one who reviewed them, or that I was the one who pushed them.
Part 2: Wherein I Handle My Second Pull Request
Thus, for the fix for bug 611042, for which Atul submitted GitHub pull request 34, I again reviewed the changes (also comprising two commits) on GitHub, but then I pushed them to the canonical repository via this different set of commands (after discussion with Atul and Patrick Walton of the Rust team):
- git checkout -b toolness-bug-611042 master
- git pull https://github.com/toolness/jetpack-sdk.git bug-611042
- (There might have been something else here, since the pull request resulted in a merge; I don't quite remember.)
- git checkout master
- git merge --no-ff --no-commit toolness-bug-611042
- git commit --signoff -m "bug 611042: remove request.response.xml for e10s compatibility; r=myk" --author "atul"
- git push upstream master
Because Atul's pull request was no longer against the tip (since I had just merged those previous changes), when I pulled the remote bug-611042 branch into my local toolness-bug-611042 branch (step 2), I had to merge his changes, which resulted in a merge commit.
Merging the changes to my local master with "--no-ff" and "--no-commit" (step 5) then allowed me to commit the merge to my master branch manually (step 6), resulting in another merge commit.
For the second merge commit, I specified "--signoff", which added "Signed-off-by: Myk Melez <m...@mozilla.org>" to the commit message; crafted a custom commit message that included "r=myk"; and specified '--author "atul"', which made Atul the author of the merge.
I dislike having the former merge commit in history, since it's extraneous, unuseful details about how I did the merging locally before I pushed to the canonical repository. I'm not sure how to avoid it, though.
On the other hand, I like having the latter merge commit in history, since it provides context for Atul's two commits: the bug number, the fact that the changes were reviewed, and a commit message that describes the changes as a whole.
I'm ambivalent about --signoff vs. adding "r=myk" to the commit message, as they seem equivalentish, with --signoff being more explicit (so in theory it might form part of an enlightened workflow in the future), while "r=myk" is simpler.
And I dislike having made Atul the author of the merge, since it's incorrect: he wasn't the author of the merge, he was only the author of the changes (for which he is correctly credited). And if the merge itself caused problems (f.e. I accidentally backed out other recent changes in the process), I would be the one responsible for fixing those problems, not Atul.
Part 3: Pushing Patches
In addition to pull requests, one can also contribute via patches. I've pushed a few of these via something like the following set of commands:
That results in a commit like this one, which shows me as the committer and the patch author as the author. And that seems like a fine record of what happened.
- git apply patch.diff
- git commit -a -m "bug <number>: <description of changes>; r=myk" --author "<author name>"
- git push upstream master
Part 4: To Bug or Not To Bug?
One of the questions GitHub raises is whether or not every change deserves a bug report. And if not, how do we differentiate those that do from the rest?
I don't have the definitive answers to these questions, but my sense, from my experience so far, is that we shouldn't require all changes to be accompanied by bug reports, but larger, riskier, time-consuming, and/or controversial changes should have reports to capture history, provide a forum for discussion, and permit project planning; while bug reports should be optional for smaller, safer, quickly-resolved, and/or non-controversial changes.
Thoughts?
-myk
Erik mentioned all most of it but let me jest post reduced snippet that does the same, except making atul an an author of a merge.
1. git remote add atul https://github.com/toolness/jetpack-sdk.git #this is one time only2. git fetch atul3. git merge atul/toolness-bug-611042 --no-ff -m 'bug 611042: remove request.response.xml for e10s compatibility; r=myk'4. git push upstream master
git fetch https://github.com/toolness/jetpack-sdk.git
bug-610507
- 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", f.e.:
git fetch https://github.com/toolness/jetpack-sdk.git bug-610507
- Merge the remote branch into the local master 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
On 11/18/2010 03:00 AM, Irakli Gozalishvili wrote:Thanks Erik and Irakli, this is really helpful!
Erik mentioned all most of it but let me jest post reduced snippet that does the same, except making atul an an author of a merge.
1. git remote add atul https://github.com/toolness/jetpack-sdk.git #this is one time only2. git fetch atul3. git merge atul/toolness-bug-611042 --no-ff -m 'bug 611042: remove request.response.xml for e10s compatibility; r=myk'4. git push upstream master
With a tip from Brian and a bit more experimentation (looking for ways to simplify as much as possible), here is where I'm currently at:
- 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", f.e.:
git fetch https://github.com/toolness/jetpack-sdk.git bug-610507
- Merge the remote branch into the local master branch with a custom commit message:
git merge FETCH_HEAD --no-ff -m"bug 610507: get rid of the nsjetpack package; r=myk"
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 (although I have to be careful not to copy a line break character along with it and issue a pull before I have had a chance to change it to a fetch), and I always type the same alias to the branch name in step three.
It does mention that it's a branch merge, but there's no way 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.
-myk