You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by pa...@apache.org on 2014/06/24 01:02:49 UTC

svn commit: r1604954 - /mahout/site/mahout_cms/trunk/content/developers/github.mdtext

Author: pat
Date: Mon Jun 23 23:02:48 2014
New Revision: 1604954

URL: http://svn.apache.org/r1604954
Log:
reworded how committers create and use PRs

Modified:
    mahout/site/mahout_cms/trunk/content/developers/github.mdtext

Modified: mahout/site/mahout_cms/trunk/content/developers/github.mdtext
URL: http://svn.apache.org/viewvc/mahout/site/mahout_cms/trunk/content/developers/github.mdtext?rev=1604954&r1=1604953&r2=1604954&view=diff
==============================================================================
--- mahout/site/mahout_cms/trunk/content/developers/github.mdtext (original)
+++ mahout/site/mahout_cms/trunk/content/developers/github.mdtext Mon Jun 23 23:02:48 2014
@@ -16,22 +16,20 @@ Notice:    Licensed to the Apache Softwa
            specific language governing permissions and limitations
            under the License.
 
-# Handling Github PRs #
+# Github Setup and Pull Requests (PRs) #
 
-When we don't want to use Github's PR collaboration tools, we always can just commit a patch directly by 
-pushing it to https://git-wip-us.apache.org/repos/asf/mahout.git.
-
-Otherwise, here's recommended procedure to resolve external github pull requests to apache/Mahout repository.
-
-## How to create a PR (for contributors)
-
-Create pull requests: \[[1]\]. 
-
-Pull requests are made to apache/mahout repository on Github. In the Github UI you should pick the master branch to target the PR. This will be reviewed and commented on so the merge is not automatic. This can be used for discussing a contributions in progress but the committer should make sure to state that it is not intended for merging with master in the comments.
+There are several ways to setup Git for committers and contributors. Contributors can safely setup 
+Git any way they choose but committers should take extra care since they can push new commits to the master at 
+Apache and various policies there make backing out mistakes problematic. Therefore all but very small changes should 
+go through a PR, even for committers. To keep the commit history clean take note of the use of --squash below
+when merging into apache/master.
 
 ##Git setup for Committers
 
-You will want to fork github's apache/mahout to your own account, this will allow Pull Requests of your own. Cloning this fork locally will set up "origin" to point to your remote fork on github as the default remote. So if you perform "git push origin master" it will go to github.
+This describes setup for one local repo and two remotes. It allows you to push the code on your machine to either your Github repo or to git-wip-us.apache.org. 
+You will want to fork github's apache/mahout to your own account on github, this will enable Pull Requests of your own. 
+Cloning this fork locally will set up "origin" to point to your remote fork on github as the default remote. 
+So if you perform "git push origin master" it will go to github.
 
 To attach to the apache git repo do the following:
 
@@ -52,22 +50,45 @@ Now if you want to experiment with a bra
 
     git checkout -b mahout-xxxx #xxxx typically is a Jira ticket number
     #do some work on the branch
-    git commit -a -m "MAHOUT-XXXX doing some work"
-    git push origin mahout-xxxx # notice pushing to 'origin' not 'apache'
+    git commit -a -m "doing some work"
+    git push origin mahout-xxxx # notice pushing to **origin** not **apache**
+
+Once you are ready to commit to the apache remote you can merge and push them directly or better yet create a PR. 
+
+##How to create a PR (committers)
+
+Push your branch to Github:
+
+    git checkout mahout-xxxx
+    git push origin mahout-xxxx
+
+Go to your mahout-xxxx branch on Github. Since you forked it from Github's apache/mahout it will default
+any PR to go to apache/master. 
 
-Once you are ready to commit to the apache master you can push them directly:
+* Click the green "Compare, review, and create pull request" button. 
+* You can edit the to and from for the PR if it isn't correct. The "base fork" should be apache/mahout unless you are collaborating 
+separately with one of the committers on the list. The "base" will be master. Don't submit a PR to one of the other 
+branches unless you know what you are doing. The "head fork" will be your forked repo and the "compare" will be 
+your mahout-xxxx branch. 
+* Click the "Create pull request" button and name the request "MAHOUT-XXXX" all caps. 
+This will connect the comments of the PR to the mailing list and Jira comments.
+* From now on the PR lives on github's apache/mahout. You use the commenting UI there.  
+* If you are looking for a review or sharing with someone else say so in the comments but don't worry about 
+automated merging of your PR--you will have to do that later. The PR is tied to your branch so you can respond to 
+comments, make fixes, and commit them from your local repo. They will appear on the PR page and be mirrored to Jira 
+and the mailing list. 
 
-    git checkout master 
-    git pull apache master # may have to fix merge conflicts
-    git merge mahout-xxxx
-    # check build and tests
-    git push apache master #this pushes all changes you just merged to the apache git remote repo
-
-Since PRs reference a specific user's branch they may be used by committers to collaborate with others or 
-to get reviews before pushing to apache. Creating a PR only establishes a place to review, you will have to 
-merge your branch as above to get it into apache/master.
+When you are satisfied and want to push it to Apache's remote repo proceed with **Merging a PR**
 
-## Merging a contributor's PR and closing it (for committers) 
+## How to create a PR (contributors)
+
+Create pull requests: \[[1]\]. 
+
+Pull requests are made to apache/mahout repository on Github. In the Github UI you should pick the master 
+branch to target the PR as described for committers. This will be reviewed and commented on so the merge is 
+not automatic. This can be used for discussing a contributions in progress.
+
+## Merging a PR (yours or contributors) 
 
 Start with reading \[[2]\] (merging locally). 
 
@@ -76,30 +97,32 @@ In this case it is recommended to squash
 than merging in a multitude of contributor's commits. In order to do that, as well as close the PR at the 
 same time, it is recommended to use **squash commits**.
 
-Merging pull requests are equivalent to merging contributor's branch:
+Merging pull requests are equivalent to a "pull" of a contributor's branch:
 
     git checkout master      # switch to local master branch
     git pull apache master   # fast-forward to current remote HEAD
     git pull --squash https://github.com/cuser/mahout cbranch  # merge to master 
 
-If you are ready to merge your own (committer's) PR you probably only need to merge, since you have a local copy that you've been working on. This is the branch that you used to create the PR.
+--squash ensures all PR history is squashed into single commit, and allows committer to use his/her own
+message. Read git help for merge or pull for more information about `--squash` option. In this example we 
+assume that the contributor's Github handle is "cuser" and the PR branch name is "cbranch". 
+Next, resolve conflicts, if any, or ask a contributor to rebase on top of master, if PR went out of sync.
+
+If you are ready to merge your own (committer's) PR you probably only need to merge (not pull), since you have a local copy 
+that you've been working on. This is the branch that you used to create the PR.
 
     git checkout master      # switch to local master branch
     git pull apache master   # fast-forward to current remote HEAD
-    git merge --squash cbranch # cbranch here is probably named mahout-xxxx for a Jira ticket
-
---squash ensures all PR history is squashed into single commit, and allows committer to use his/her own
-message. Read git help for merge or pull for more information about `--squash` option. In this example we assume that the contributor's Github handle is "cuser" and the PR branch name is "cbranch". 
-Next, resolve conflicts, if any, or ask a contributor to rebase on top of master, if PR went out of sync.
+    git merge --squash mahout-xxxx
 
 Remember to run regular patch checks, build with tests enabled, and change CHANGELOG.
 
 If everything is fine, you now can commit the squashed request along the lines
 
-    git commit -a -m "MAHOUT-YYYY description (cuser via your-apache-id) closes apache/mahout#ZZ"
+    git commit -a -m "MAHOUT-XXXX description (cuser via your-apache-id) closes apache/mahout#ZZ"
 
-where `ZZ` is the pull request number on apache/mahout repository. Including "closes apache/mahout#ZZ" 
-will close PR automatically. More information is found here \[[3]\].
+MAHOUT-XXXX is all caps and where `ZZ` is the pull request number on apache/mahout repository. Including 
+"closes apache/mahout#ZZ" will close the PR automatically. More information is found here \[[3]\].
 
 Next, push to git-wip-us.a.o: