Skip to content

Commit 382e543

Browse files
rocketramangitster
authored andcommitted
Add branch management for releases to gitworkflows
The current man page does a reasonable job at describing branch management during the development process, but it does not contain any guidance as to how the branches are affected by releases. Add a basic introduction to the branch management undertaken during a git.git release, so that a reader may gain some insight into how the integration, maintenance, and topic branches are affected during the release transition, and is thus able to better design the process for their own project. Other release activities such as reviews, testing, and creating distributions are currently out of scope. Signed-off-by: Nanako Shiraishi <[email protected]> Acked-by: Thomas Rast <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 78d553b commit 382e543

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

Documentation/gitworkflows.txt

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,121 @@ chance to see if their in-progress work will be compatible. `git.git`
209209
has such an official throw-away integration branch called 'pu'.
210210

211211

212+
Branch management for a release
213+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214+
215+
Assuming you are using the merge approach discussed above, when you
216+
are releasing your project you will need to do some additional branch
217+
management work.
218+
219+
A feature release is created from the 'master' branch, since 'master'
220+
tracks the commits that should go into the next feature release.
221+
222+
The 'master' branch is supposed to be a superset of 'maint'. If this
223+
condition does not hold, then 'maint' contains some commits that
224+
are not included on 'master'. The fixes represented by those commits
225+
will therefore not be included in your feature release.
226+
227+
To verify that 'master' is indeed a superset of 'maint', use git log:
228+
229+
.Verify 'master' is a superset of 'maint'
230+
[caption="Recipe: "]
231+
=====================================
232+
git log master..maint
233+
=====================================
234+
235+
This command should not list any commits. Otherwise, check out
236+
'master' and merge 'maint' into it.
237+
238+
Now you can proceed with the creation of the feature release. Apply a
239+
tag to the tip of 'master' indicating the release version:
240+
241+
.Release tagging
242+
[caption="Recipe: "]
243+
=====================================
244+
`git tag -s -m "GIT X.Y.Z" vX.Y.Z master`
245+
=====================================
246+
247+
You need to push the new tag to a public git server (see
248+
"DISTRIBUTED WORKFLOWS" below). This makes the tag available to
249+
others tracking your project. The push could also trigger a
250+
post-update hook to perform release-related items such as building
251+
release tarballs and preformatted documentation pages.
252+
253+
Similarly, for a maintenance release, 'maint' is tracking the commits
254+
to be released. Therefore, in the steps above simply tag and push
255+
'maint' rather than 'master'.
256+
257+
258+
Maintenance branch management after a feature release
259+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
260+
261+
After a feature release, you need to manage your maintenance branches.
262+
263+
First, if you wish to continue to release maintenance fixes for the
264+
feature release made before the recent one, then you must create
265+
another branch to track commits for that previous release.
266+
267+
To do this, the current maintenance branch is copied to another branch
268+
named with the previous release version number (e.g. maint-X.Y.(Z-1)
269+
where X.Y.Z is the current release).
270+
271+
.Copy maint
272+
[caption="Recipe: "]
273+
=====================================
274+
`git branch maint-X.Y.(Z-1) maint`
275+
=====================================
276+
277+
The 'maint' branch should now be fast-forwarded to the newly released
278+
code so that maintenance fixes can be tracked for the current release:
279+
280+
.Update maint to new release
281+
[caption="Recipe: "]
282+
=====================================
283+
* `git checkout maint`
284+
* `git merge --ff-only master`
285+
=====================================
286+
287+
If the merge fails because it is not a fast-forward, then it is
288+
possible some fixes on 'maint' were missed in the feature release.
289+
This will not happen if the content of the branches was verified as
290+
described in the previous section.
291+
292+
293+
Branch management for next and pu after a feature release
294+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
295+
296+
After a feature release, the integration branch 'next' may optionally be
297+
rewound and rebuilt from the tip of 'master' using the surviving
298+
topics on 'next':
299+
300+
.Rewind and rebuild next
301+
[caption="Recipe: "]
302+
=====================================
303+
* `git checkout next`
304+
* `git reset --hard master`
305+
* `git merge ai/topic_in_next1`
306+
* `git merge ai/topic_in_next2`
307+
* ...
308+
=====================================
309+
310+
The advantage of doing this is that the history of 'next' will be
311+
clean. For example, some topics merged into 'next' may have initially
312+
looked promising, but were later found to be undesirable or premature.
313+
In such a case, the topic is reverted out of 'next' but the fact
314+
remains in the history that it was once merged and reverted. By
315+
recreating 'next', you give another incarnation of such topics a clean
316+
slate to retry, and a feature release is a good point in history to do
317+
so.
318+
319+
If you do this, then you should make a public announcement indicating
320+
that 'next' was rewound and rebuilt.
321+
322+
The same rewind and rebuild process may be followed for 'pu'. A public
323+
announcement is not necessary since 'pu' is a throw-away branch, as
324+
described above.
325+
326+
212327
DISTRIBUTED WORKFLOWS
213328
---------------------
214329

0 commit comments

Comments
 (0)