You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by Apache Wiki <wi...@apache.org> on 2012/02/14 09:05:49 UTC

[Cordova Wiki] Update of "ContributerWorkflow" by FilMaj

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cordova Wiki" for change notification.

The "ContributerWorkflow" page has been changed by FilMaj:
http://wiki.apache.org/cordova/ContributerWorkflow?action=diff&rev1=5&rev2=6

Comment:
working out the contributor workflow, copying most of Michael Brook's work verbatim

+ = Contributor License Agreement =
-   1. Identify work to be done. JIRA and the mailing list are great places to start!
-   1. Fork the official Apache Cordova project mirror on Github here: http://github.com/apache
-   1. Create a topic branch with your commits.
-   1. Send a pull request to the official Apache Cordova mirror on Github. (That will send a message for review on the Apache Cordova mailing list.) Optionally you may wish to comment on and advocate for your changes on list. You will need to have signed off on the [[http://www.apache.org/licenses/icla.txt|Apache CLA]] in order for changes to be accepted.
-   1. Once reviewed a committer will pull your changes into the official Apache Cordova git: http://git.apache.org and the changes will be mirrored on Github.
  
+ You will need to have signed off on the [[http://www.apache.org/licenses/icla.txt|Apache CLA]] in order for changes to be accepted.
+ 
+ = Identify Work =
+ 
+ [[http://apache.issues.org/jira|JIRA]] and the [[http://mail-archives.apache.org/mod_mbox/incubator-callback-dev/|mailing list]] are great places to start!
+ 
+ = Fork =
+ 
+ Fork the official Apache Cordova project mirror with git, the chosen revision control system for the Cordova project. There are many places to clone the code from:
+ 
+  * from the [[http://git-wip-us.apache.org/repos/asf|official Apache servers]]
+  * on [[http://github.com/apache|GitHub]]
+ 
+ For example, to fork the cordova documentation repository, from your shell you would run:
+ 
+ {{{
+ $ git clone http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs.git
+ }}}
+ 
+ = Working in git =
+ 
+ The Cordova community encourages a certain type of workflow within git. However, the below are only guidelines.
+ 
+ == Topic Branch ==
+  
+ A good habit to get into is using topic branches for your work, while keeping the master branch untouched. You can then keep the master branch up-to-date with the main repository without worrying about merge conflicts.
+  
+ === Reduce Merge Conflicts ===
+  
+ By not working on the master branch, you ensure that the branch's history will not diverge from the main repository's master branch. This allows you to pull in updates from the main repository without merge conflicts.
+  
+ === Organize and Isolate Contributions ===
+  
+ By creating a topic branch for each contribution, you effectively isolate your changes into a single branch of history. As long as the topic branch is up-to-date, your changes will merge cleanly into the main repository. If your contributions cannot be merged cleanly, the repository maintainer may have to reject your contribution until you update it.
+  
+ === Easier for the Maintainer ===
+  
+ Maintainers like topic branches. It is easier to review the pull request and merge commits into the main repository.
+  
+ == Git Workflow ==
+  
+ Consider that you've decided to work on ticket #11 for the incubator-cordova-docs repository. You are charged with updating some documentation.
+  
+ === Update your master branch ===
+ 
+ We're assuming you have cloned the docs repository as per the example above, and have the docs repository set up as a "cordova" remote, with your own fork as the "origin". Let's first make sure your fork is up-to-date.
+ 
+ {{{
+ $ git checkout master
+ $ git pull cordova master
+ $ git push origin master
+ }}}
+  
+ === Create a topic branch ===
+ 
+ Let's create a new branch based off of master and call it "ticket_11".
+ 
+ {{{
+ $ git checkout master
+ $ git checkout -b ticket_11
+ $ git branch
+   master
+ * ticket_11
+ }}}
+ 
+ You can name the topic branch anything, but it makes sense to name it after the ticket. This topic branch is now isolated and branched off the history of your master branch.
+  
+ === Make File Changes ===
+ 
+ Let's update the accelerometer documentation for the "watchPosition" function.
+ 
+ {{{
+ $ [ edit accelerometer/watchPosition.md ]
+ $ git status
+   modified: accelerometer/watchPostion.md
+ }}}
+  
+ git status shows that you have modified one file.
+  
+ === Commit the File Changes ===
+ 
+ git add will stage the file changes. You can then commit the staged file(s) with git commit. This is always the process to make changes to a git repository: stage, then commit.
+ 
+ {{{
+ $ git add accelerometer/watchPosition.md
+ $ git status
+ $ git commit -m "Add iPhone as supported for accelerometer.watchPosition."
+ }}}
+  
+ Alternatively, you could combine staging and committing by using git commit -am "...." 
+  
+ === Commit More File Changes ===
+ 
+ {{{
+ $ [ edit accelerometer/watchPosition.md ]
+ $ git commit -am "Fix syntax error watchPosition example." 
+ }}}
+  
+ === Prepare to Send Pull Request ===
+ 
+ Before sending the pull request, you should ensure that your changes merge cleanly with the main documentation repository.
+ 
+ {{{
+ $ git checkout master
+ $ git pull phonegap master
+ $ git checkout ticket_11
+ $ git rebase master
+ }}}
+ 
+ You can do this by pulling the latest changes from the main repository back into our master. We make sure that our master is always in sync before issuing pull requests. Next, we rebase the history of the master branch onto the topic branch ticket_11. Essentially, this will rewind your divergent commits, fast-forward your topic branch to the latest commit of the master, and then re-apply your topic branch commits in order. Ensures a clean application of code changes. The [[http://book.git-scm.com/4_rebasing.html|git community book has an excellent chapter on rebasing]].
+  
+ Alternatively, you can use git merge master instead of git rebase master, but your topic branches history may not be as clean.
+ 
+ Last thing is to make your code changes available from your fork.
+ 
+ {{{
+ $ git checkout ticket_11
+ $ git push origin ticket_11
+ }}}
+  
+ == Sharing your Changes ==
+ 
+ By pushing your topic branch onto your fork, an incubator-cordova-docs maintainer can review and merge the topic branch into the main repository.
+  
+ === Sending a Pull Request from GitHub ===
+ 
+ Pull requests sent to the [[http://github.com/apache|Apache GitHub repositories]] should forward a pull request e-mail to the dev mailing list. It is strongly recommended that you sign up for the mailing list before issuing a pull request and make sure the list is notified. Thanks :)
+  
+  * Open a web browser to your GitHub account's incubator-cordova-docs fork.
+  * Select your topic branch so that the pull request references the topic branch.
+  * Click the Pull Request button.
+ 
+ === Notifying the Mailing List ===
+ 
+ Optionally, you may wish to comment on and advocate for your changes on list. We highly suggest you sign up for the dev mailing list!
+  
+ == While Waiting, Continuing Crafting Commits ==
+  
+ Since you worked on the topic branch instead of the master branch, you can continue working while waiting for the pull request to go through.
+  
+ Be sure to create the topic branch from master.
+ 
+ {{{
+ $ git checkout master
+ $ git pull cordova master
+ $ git checkout -b fix_ugly_vibrate_example
+ $ git branch -a
+ * fix_ugly_vibrate_example
+   master
+   ticket_11
+ }}}
+ 
+ == When Your Pull Request is Accepted ==
+ 
+ {{{
+ $ git checkout master
+ $ git pull cordova master
+ $ git log 
+ ( hey there's me! ya! )
+ }}}
+  
+ You can now delete your topic branch, because it is now merged into the main repository and in the master branch.
+ 
+ {{{
+ $ git branch -d ticket_11
+ $ git push origin :ticket_11
+ }}}
+ 
+ I know, deleting a remote topic branch is ugly (git push origin :ticket_11).
+  
+ == If Your Pull Request is Rejected ==
+  
+ In this case, you just need to update your branch from the main repository and then address the rejection reason.
+ 
+ {{{
+ $ git checkout master
+ $ git pull cordova master
+ $ git checkout ticket_11
+ $ git rebase master
+ ( edit / commit / edit / commit)
+ $ git push origin ticket_11
+ }}}
+