Development cycle » History » Version 4
Tom Clegg, 08/12/2011 03:01 PM
1 | 1 | Tom Clegg | h1. Development cycle |
---|---|---|---|
2 | |||
3 | 4 | Tom Clegg | h2. Getting the code base |
4 | |||
5 | git clone git@git.clinicalfuture.com:pgp-enroll.git |
||
6 | |||
7 | 1 | Tom Clegg | h2. Writing and contributing code |
8 | |||
9 | Start a branch like username/master or username/rails3 |
||
10 | |||
11 | git branch example/rails3 |
||
12 | git checkout example/rails3 |
||
13 | |||
14 | Do something trivial like |
||
15 | |||
16 | * add app/views/pages/specimen_collection.html.erb |
||
17 | * add link to it in app/views/pages/home.html.erb |
||
18 | |||
19 | 3 | Tom Clegg | Commit it. If you refer to the issue# in the comment, redmine will notice this and do smart things (e.g., link to the commit from the issue page). |
20 | 1 | Tom Clegg | |
21 | git add ... |
||
22 | 3 | Tom Clegg | git commit -m 'description of stuff (closes #123)' |
23 | 1 | Tom Clegg | |
24 | Push it |
||
25 | |||
26 | git push |
||
27 | |||
28 | Generate a pull request |
||
29 | |||
30 | git request-pull e68ab19^ git@git.clinicalfuture.com:pgp-enroll.git e68ab19 |
||
31 | |||
32 | Send the pull request to someone like Ward |
||
33 | |||
34 | 2 | Ward Vandewege | h2. Merging code from other contributors/branches |
35 | 1 | Tom Clegg | |
36 | 4 | Tom Clegg | Fetch latest code in other developers branches |
37 | 1 | Tom Clegg | |
38 | 4 | Tom Clegg | git fetch |
39 | 1 | Tom Clegg | |
40 | 4 | Tom Clegg | List remote branches |
41 | |||
42 | git branch -a |
||
43 | |||
44 | 1 | Tom Clegg | Switch to the other branch |
45 | 2 | Ward Vandewege | |
46 | 1 | Tom Clegg | git checkout origin/example/rails3 |
47 | 2 | Ward Vandewege | |
48 | (git will complain about being in a detached head state, but that's fine - just don't commit to this state) |
||
49 | |||
50 | Now look around, test |
||
51 | 1 | Tom Clegg | |
52 | 2 | Ward Vandewege | git log |
53 | |||
54 | 4 | Tom Clegg | Switch to production branch (set up with @git checkout --track origin/rails3@ if you haven't already) and make sure it's up-to-date |
55 | 2 | Ward Vandewege | |
56 | git checkout rails3 |
||
57 | 4 | Tom Clegg | git pull origin rails3 |
58 | 2 | Ward Vandewege | |
59 | 1 | Tom Clegg | Cherry-pick a commit |
60 | |||
61 | git cherry-pick e68ab19 |
||
62 | |||
63 | 2 | Ward Vandewege | Or merge the entire remote tree (this will fetch and merge but not yet commit) |
64 | |||
65 | git merge --no-commit origin/tomc/rails3 |
||
66 | |||
67 | When you're happy, |
||
68 | |||
69 | git commit |
||
70 | |||
71 | Or rewind |
||
72 | |||
73 | git reset --hard rails3 |
||
74 | |||
75 | Finally, push |
||
76 | 1 | Tom Clegg | |
77 | git push |