Update README.md
[jquery.git] / README.md
blobad38c228b34da724f41089f5295b19ed1c114ace
1 [jQuery](http://jquery.com/) - New Wave JavaScript
2 ==================================================
4 Contribution Guides
5 --------------------------------------
7 In the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly:
9 1. [Getting Involved](http://docs.jquery.com/Getting_Involved)
10 2. [Core Style Guide](http://docs.jquery.com/JQuery_Core_Style_Guidelines)
11 3. [Tips For Bug Patching](http://docs.jquery.com/Tips_for_jQuery_Bug_Patching)
14 Running the Unit Tests
15 --------------------------------------
17 Run the unit tests with a local server that supports PHP. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:
19 - Windows: [WAMP download](http://www.wampserver.com/en/)
20 - Mac: [MAMP download](http://www.mamp.info/en/index.html)
21 - Linux: [Setting up LAMP](https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation)
22 - [Mongoose (most platforms)](http://code.google.com/p/mongoose/)
25 What you need to build your own jQuery
26 --------------------------------------
28 In order to build jQuery, you need to have GNU make 3.8 or later, Node.js 0.4.12 or later, and git 1.7 or later.
29 (Earlier versions might work OK, but are not tested.)
31 Windows users have two options:
33 1. Install [msysgit](https://code.google.com/p/msysgit/) (Full installer for official Git),
34    [GNU make for Windows](http://gnuwin32.sourceforge.net/packages/make.htm), and a
35    [binary version of Node.js](http://node-js.prcn.co.cc/). Make sure all three packages are installed to the same
36    location (by default, this is C:\Program Files\Git).
37 2. Install [Cygwin](http://cygwin.com/) (make sure you install the git, make, and which packages), then either follow
38    the [Node.js build instructions](https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-%28Windows%29) or install
39    the [binary version of Node.js](http://node-js.prcn.co.cc/).
41 Mac OS users should install Xcode (comes on your Mac OS install DVD, or downloadable from
42 [Apple's Xcode site](http://developer.apple.com/technologies/xcode.html)) and
43 [http://mxcl.github.com/homebrew/](Homebrew). Once Homebrew is installed, run `brew install git` to install git,
44 and `brew install node` to install Node.js.
46 Linux/BSD users should use their appropriate package managers to install make, git, and node, or build from source
47 if you swing that way. Easy-peasy.
50 How to build your own jQuery
51 ----------------------------
53 First, clone a copy of the main jQuery git repo by running `git clone git://github.com/jquery/jquery.git`.
55 Then, to get a complete, minified, jslinted version of jQuery, simply `cd` to the `jquery` directory and type
56 `make`. If you don't have Node installed and/or want to make a basic, uncompressed, unlinted version of jQuery, use
57 `make jquery` instead of `make`.
59 The built version of jQuery will be put in the `dist/` subdirectory.
61 To remove all built files, run `make clean`.
64 Building to a different directory
65 ---------------------------------
67 If you want to build jQuery to a directory that is different from the default location, you can specify the PREFIX
68 directory: `make PREFIX=/home/jquery/test/ [command]`
70 With this example, the output files would end up in `/home/jquery/test/dist/`.
73 Troubleshooting
74 ---------------
76 Sometimes, the various git repositories get into an inconsistent state where builds don't complete properly
77 (usually this results in the jquery.js or jquery.min.js being 0 bytes). If this happens, run `make clean`, then
78 run `make` again.
80 Git for dummies
81 ---------------
83 As the source code is handled by the version control system Git, it's useful to know some features used.
85 ### Submodules ###
87 The repository uses submodules, which normally are handled directly by the Makefile, but sometimes you want to
88 be able to work with them manually.
90 Following are the steps to manually get the submodules:
92 1. `git clone https://github.com/jquery/jquery.git`
93 2. `git submodule init`
94 3. `git submodule update`
96 Or:
98 1. `git clone https://github.com/jquery/jquery.git`
99 2. `git submodule update --init`
103 1. `git clone --recursive https://github.com/jquery/jquery.git`
105 If you want to work inside a submodule, it is possible, but first you need to checkout a branch:
107 1. `cd src/sizzle`
108 2. `git checkout master`
110 After you've committed your changes to the submodule, you'll update the jquery project to point to the new commit,
111 but remember to push the submodule changes before pushing the new jquery commit:
113 1. `cd src/sizzle`
114 2. `git push origin master`
115 3. `cd ..`
116 4. `git add src/sizzle`
117 5. `git commit`
119 The makefile has some targets to simplify submodule handling:
121 #### `make update_submodules` ####
123 checks out the commit pointed to by jquery, but merges your local changes, if any. This target is executed
124 when you are doing a normal `make`.
126 #### `make pull_submodules` ####
128 updates the content of the submodules to what is probably the latest upstream code.
130 #### `make pull` ####
132 make a `make pull_submodules` and after that a `git pull`. if you have no remote tracking in your master branch, you can
133 execute this command as `make pull REMOTE=origin BRANCH=master` instead.
135 ### cleaning ###
137 If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):
139 1. `git reset --hard upstream/master`
140 2. `git clean -fdx`
142 ### rebasing ###
144 For feature/topic branches, you should always used the `--rebase` flag to `git pull`, or if you are usually handling many temporary "to be in a github pull request" branches, run following to automate this:
146 * `git config branch.autosetuprebase local` (see `man git-config` for more information)
148 ### handling merge conflicts ###
150 If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature
151 `git mergetool`. Even though the default tool `xxdiff` looks awful/old, it's rather useful.
153 Following are some commands that can be used there:
155 * `Ctrl + Alt + M` - automerge as much as possible
156 * `b` - jump to next merge conflict
157 * `s` - change the order of the conflicted lines
158 * `u` - undo an merge
159 * `left mouse button` - mark a block to be the winner
160 * `middle mouse button` - mark a line to be the winner
161 * `Ctrl + S` - save
162 * `Ctrl + Q` - quit
164 Questions?
165 ----------
167 If you have any questions, please feel free to ask on the
168 [Developing jQuery Core forum](http://forum.jquery.com/developing-jquery-core) or in #jquery on irc.freenode.net.