Project

General

Profile

Tagging » History » Version 5

Herbert Greenlee, 02/12/2015 11:36 AM

1 5 Herbert Greenlee
{{toc}}
2 2 Herbert Greenlee
3 5 Herbert Greenlee
h1. Tagging a branch for release (manual method)
4 2 Herbert Greenlee
5 5 Herbert Greenlee
Releases are built from the @master@ branch.  This recipe shows how to create a tag on the @master@ branch of a git repository.
6 2 Herbert Greenlee
7 3 Herbert Greenlee
First, get your local copies of develop and master branches up to date with the main repository.
8 1 Herbert Greenlee
<pre>
9 4 Herbert Greenlee
cd $MRB_SOURCE/<package>
10 3 Herbert Greenlee
git checkout develop
11 3 Herbert Greenlee
git pull
12 2 Herbert Greenlee
git checkout master
13 2 Herbert Greenlee
git pull
14 2 Herbert Greenlee
</pre>
15 2 Herbert Greenlee
16 2 Herbert Greenlee
Then update master with changes from develop or other source branch.
17 2 Herbert Greenlee
<pre>
18 2 Herbert Greenlee
git merge develop
19 2 Herbert Greenlee
</pre>
20 1 Herbert Greenlee
21 4 Herbert Greenlee
At this point, you can make further changes to your master branch, including the version number of the package being tagged and version numbers of dependent products, both stored in product_deps.  After making all updates, it is a good idea to do a full test build, including tests.
22 1 Herbert Greenlee
<pre>
23 4 Herbert Greenlee
cd $MRB_BUILDDIR
24 4 Herbert Greenlee
mrb i -j4
25 4 Herbert Greenlee
mrb t -j4
26 4 Herbert Greenlee
</pre>  
27 4 Herbert Greenlee
When you are done updating master, commit and push your changes to the main repository.
28 4 Herbert Greenlee
<pre>
29 4 Herbert Greenlee
cd $MRB_SOURCE/<package>
30 2 Herbert Greenlee
git commit
31 2 Herbert Greenlee
git push origin master
32 2 Herbert Greenlee
</pre>
33 2 Herbert Greenlee
34 2 Herbert Greenlee
Now make the actual tag and push the tag to the main repository.
35 2 Herbert Greenlee
<pre>
36 2 Herbert Greenlee
git tag -a -m"v02_05_01" v02_05_01   # Annotated tag.
37 2 Herbert Greenlee
git push origin v02_05_01            # Or git push --tags
38 2 Herbert Greenlee
</pre>
39 2 Herbert Greenlee
If you want to move an existing tag, you need to add option @-f@ or @--force@ to the last two commands.
40 2 Herbert Greenlee
41 2 Herbert Greenlee
If you made changes directly on the master branch, like updating the version number in product_deps, you should merge these back into the develop branch.
42 2 Herbert Greenlee
<pre>
43 1 Herbert Greenlee
git checkout develop
44 1 Herbert Greenlee
git merge master
45 1 Herbert Greenlee
git push origin develop
46 5 Herbert Greenlee
</pre>
47 5 Herbert Greenlee
48 5 Herbert Greenlee
h1. Tagging a branch for release (git flow release branch method)
49 5 Herbert Greenlee
50 5 Herbert Greenlee
First, get your local copies of develop and master branches up to date with the main repository.
51 5 Herbert Greenlee
<pre>
52 5 Herbert Greenlee
cd $MRB_SOURCE/<package>
53 5 Herbert Greenlee
git checkout develop
54 5 Herbert Greenlee
git pull
55 5 Herbert Greenlee
git checkout master
56 5 Herbert Greenlee
git pull
57 5 Herbert Greenlee
</pre>
58 5 Herbert Greenlee
59 5 Herbert Greenlee
Use git flow to create a release branch in your local repository.  Git flow creates the release branch from the head of develop.  
60 5 Herbert Greenlee
<pre>
61 5 Herbert Greenlee
git flow release start v03_08_02 
62 5 Herbert Greenlee
</pre>
63 5 Herbert Greenlee
64 5 Herbert Greenlee
At this point, you can update your release branch, including updating @ups/product_deps@ the version number and dependencies of the package being released.  After making all updates, it is a good idea to do a full test build, including tests.
65 5 Herbert Greenlee
<pre>
66 5 Herbert Greenlee
cd $MRB_BUILDDIR
67 5 Herbert Greenlee
mrb i -j4
68 5 Herbert Greenlee
mrb t -j4
69 5 Herbert Greenlee
</pre>  
70 5 Herbert Greenlee
When you are done updating the release branch, commit updates to your local repository.
71 5 Herbert Greenlee
<pre>
72 5 Herbert Greenlee
cd $MRB_SOURCE/<package>
73 5 Herbert Greenlee
git commit
74 5 Herbert Greenlee
</pre>
75 5 Herbert Greenlee
76 5 Herbert Greenlee
Use git flow to "finish" the release branch.
77 5 Herbert Greenlee
78 5 Herbert Greenlee
<pre>
79 5 Herbert Greenlee
git flow release finish -m"v03_08_02" v03_08_02
80 5 Herbert Greenlee
</pre>
81 5 Herbert Greenlee
This command does the following actions.
82 5 Herbert Greenlee
* Merges release branch to master.
83 5 Herbert Greenlee
* Merges release branch to develop.
84 5 Herbert Greenlee
* Creates a tag on the master branch.
85 5 Herbert Greenlee
* Deletes the release branch.
86 5 Herbert Greenlee
87 5 Herbert Greenlee
Now push everything up to main repository.
88 5 Herbert Greenlee
<pre>
89 5 Herbert Greenlee
git push origin develop master
90 5 Herbert Greenlee
git push v03_08_02             # Or git push --tags
91 2 Herbert Greenlee
</pre>