Projecte

General

Perfil

Repository » Historial » Versió 38

Simó Albert i Beltran, 07-03-2013 17:21
New feature workflow.

1 1 Pau Escrich
h1. Repository
2
3 35 Simó Albert i Beltran
At the moment we work with a main branch, the master branch.
4
5 36 Simó Albert i Beltran
If you want solve a bug you could start a new branch based in a commit that introduces a bug or based in a head of master branch.
6 38 Simó Albert i Beltran
7 36 Simó Albert i Beltran
<pre>
8
     ----o issue#23
9
    /     \
10
o--o--o----o master
11
   ^
12
    commit with an error, it causes error described in issue 23.
13 38 Simó Albert i Beltran
</pre>
14
15
<pre>
16
     o--o issue#23
17
    /
18
o--o master
19
   ^
20
    this commit is not related with the issue 23, but right now is the head of master branch.
21
</pre>
22
23
If you want implement a new feature is preferable you start a new branch based in a head of master branch, optionally you can start a new branch based in a commit that contains features implemented by other branch.
24
25
<pre>
26
     o--o--o issue#23
27
    /
28
o--o master
29
</pre>
30
31
<pre>
32
             o--o issue#23
33
            /
34
     o--o--o--o--o issue#21
35
    /      ^this commit has last changes needed for new feature that is described in issue 23.
36
o--o master
37 37 Simó Albert i Beltran
</pre>
38 35 Simó Albert i Beltran
39
h1. Possible future workflow:
40
41 1 Pau Escrich
h2. Structure
42
43
The qMp git repository is split in three branches:
44
45
# Master
46
# Testing
47 23 Simó Albert i Beltran
# Other: Features/Bugfixes
48 1 Pau Escrich
49
h3. Master
50
51
This is the main branch and all changes committed here must be tested in Testing branch before.
52
53 6 Simó Albert i Beltran
However the small bugfixes can be directly applied here. These changes must be merged in the testing branch.
54 1 Pau Escrich
55 10 Simó Albert i Beltran
<pre>
56
o---o---o---o---o master
57
                 \  
58
--o---o---o---o---o testing 
59
</pre>
60
61 22 Simó Albert i Beltran
*Example:*
62 30 Anònim
<pre><code class="shell">
63 32 Simó Albert i Beltran
git checkout origin/testing
64
git merge origin/master
65 29 Simó Albert i Beltran
</code></pre>
66 22 Simó Albert i Beltran
67
68 1 Pau Escrich
h3. Testing
69
70 8 Simó Albert i Beltran
This is the branch for test new features and changes. The features must be already working features tested before in a specific branch by at least the developer. A feature can be committed here only when it is finished, but not in a middle state.
71 1 Pau Escrich
72 15 Simó Albert i Beltran
When the testing branch are deeply tested by more than one developer, than it can be merged on the master branch.
73 11 Simó Albert i Beltran
74
<pre>
75
o---o---o---o---o master
76
     \         /  
77
--o---o---o---o testing 
78
</pre>
79
80 16 Pau Escrich
*Example:*
81 11 Simó Albert i Beltran
82 16 Pau Escrich
Import master bugfixes to testing
83 30 Anònim
<pre><code class="shell">
84 32 Simó Albert i Beltran
git checkout origin/testing
85
git merge origin/master
86 29 Simó Albert i Beltran
</code></pre>
87 16 Pau Escrich
88
Merge testing changes in master
89 30 Anònim
<pre><code class="shell">
90 32 Simó Albert i Beltran
git checkout origin/master
91
git merge origin/testing
92 29 Simó Albert i Beltran
</code></pre>
93 16 Pau Escrich
94 12 Simó Albert i Beltran
h3. Other: Features/Bugfixes
95 1 Pau Escrich
96 8 Simó Albert i Beltran
The rest of the branches are temporal branches.
97
98 26 Simó Albert i Beltran
h4. Features
99
100 34 Simó Albert i Beltran
If it is about a new feature the name of the branch must be the name of the feature (of some name which identifies it). These branches are considered non-functional, so a non-finished feature can be committed here. This branch should preferably be based on a commit of master branch. Once the feature is finish and tested by at least the developer, it should be merged to testing and other branches.
101 1 Pau Escrich
102 9 Simó Albert i Beltran
<pre>
103
o---o---o---o---o master
104 14 Simó Albert i Beltran
     \
105 9 Simó Albert i Beltran
      o---o---o issue#23-new-feature
106 14 Simó Albert i Beltran
               \
107 9 Simó Albert i Beltran
o---o---o---o---o testing 
108
</pre>
109
110 16 Pau Escrich
*Example:*
111 9 Simó Albert i Beltran
112 30 Anònim
<pre><code class="shell">
113 24 Simó Albert i Beltran
git checkout -b issue#23-new-feature origin/master
114
editor dir/file
115 25 Simó Albert i Beltran
git add dir/file
116 24 Simó Albert i Beltran
git commit
117
#test issue#23-new-feature branch
118 32 Simó Albert i Beltran
git checkout origin/testing
119 24 Simó Albert i Beltran
git merge issue#23-new-feature
120 29 Simó Albert i Beltran
</code></pre>
121 24 Simó Albert i Beltran
122 27 Simó Albert i Beltran
h4. Bugfixes
123 24 Simó Albert i Beltran
124 33 Simó Albert i Beltran
A bugfix must be implemented in a new branch. This branch must be based on a commit of the master branch. This branch should not be based on a commit of the testing branch because it may contain new features and these maybe cannot be imported in the master branch. This new branch can be merged in testing and other branches.
125 7 Simó Albert i Beltran
126
<pre>
127
o---o---o---o---o master
128 1 Pau Escrich
     \         /
129 9 Simó Albert i Beltran
      o---o---o issue#23-bugfix
130 7 Simó Albert i Beltran
               \
131
o---o---o---o---o testing 
132
</pre>
133 16 Pau Escrich
134
*Example:*
135 1 Pau Escrich
136 30 Anònim
<pre><code class="shell">
137 28 Simó Albert i Beltran
git checkout -b issue#23-bugfix origin/master
138
editor dir/file
139
git add dir/file
140
git commit
141
#test issue#23-bugfix branch
142
git checkout origin/testing
143
git merge issue#23-bugfix
144
git checkout origin/master
145
git merge issue#23-bugfix
146 29 Simó Albert i Beltran
</code></pre>
147 28 Simó Albert i Beltran
148
149 1 Pau Escrich
h2. How to use it
150
151 2 Pau Escrich
152
h2. Good practices