Project

General

Profile

Tagging » History » Version 10

Herbert Greenlee, 03/13/2015 02:12 PM

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 8 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.  In particular, you may with to edit the following files.
22 8 Herbert Greenlee
23 10 Herbert Greenlee
* ups/product_deps
24 8 Herbert Greenlee
25 8 Herbert Greenlee
After making all updates, it is a good idea to do a full test build, including tests.
26 1 Herbert Greenlee
<pre>
27 4 Herbert Greenlee
cd $MRB_BUILDDIR
28 4 Herbert Greenlee
mrb i -j4
29 4 Herbert Greenlee
mrb t -j4
30 4 Herbert Greenlee
</pre>  
31 4 Herbert Greenlee
When you are done updating master, commit and push your changes to the main repository.
32 4 Herbert Greenlee
<pre>
33 4 Herbert Greenlee
cd $MRB_SOURCE/<package>
34 2 Herbert Greenlee
git commit
35 2 Herbert Greenlee
git push origin master
36 2 Herbert Greenlee
</pre>
37 2 Herbert Greenlee
38 2 Herbert Greenlee
Now make the actual tag and push the tag to the main repository.
39 2 Herbert Greenlee
<pre>
40 2 Herbert Greenlee
git tag -a -m"v02_05_01" v02_05_01   # Annotated tag.
41 2 Herbert Greenlee
git push origin v02_05_01            # Or git push --tags
42 2 Herbert Greenlee
</pre>
43 2 Herbert Greenlee
If you want to move an existing tag, you need to add option @-f@ or @--force@ to the last two commands.
44 2 Herbert Greenlee
45 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.
46 2 Herbert Greenlee
<pre>
47 1 Herbert Greenlee
git checkout develop
48 1 Herbert Greenlee
git merge master
49 1 Herbert Greenlee
git push origin develop
50 5 Herbert Greenlee
</pre>
51 5 Herbert Greenlee
52 5 Herbert Greenlee
h1. Tagging a branch for release (git flow release branch method)
53 5 Herbert Greenlee
54 5 Herbert Greenlee
First, get your local copies of develop and master branches up to date with the main repository.
55 5 Herbert Greenlee
<pre>
56 5 Herbert Greenlee
cd $MRB_SOURCE/<package>
57 5 Herbert Greenlee
git checkout develop
58 5 Herbert Greenlee
git pull
59 5 Herbert Greenlee
git checkout master
60 5 Herbert Greenlee
git pull
61 5 Herbert Greenlee
</pre>
62 5 Herbert Greenlee
63 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.  
64 5 Herbert Greenlee
<pre>
65 5 Herbert Greenlee
git flow release start v03_08_02 
66 1 Herbert Greenlee
</pre>
67 1 Herbert Greenlee
68 1 Herbert Greenlee
After this command, the newly created release branch will be the checked out branch.  At this point, you can make further changes to your release branch, including the version number of the package being tagged and version numbers of dependent products.  In particular, you may with to edit the following files.
69 9 Herbert Greenlee
70 10 Herbert Greenlee
* ups/product_deps
71 9 Herbert Greenlee
72 9 Herbert Greenlee
After making all updates, it is a good idea to do a full test build, including tests.
73 5 Herbert Greenlee
<pre>
74 5 Herbert Greenlee
cd $MRB_BUILDDIR
75 5 Herbert Greenlee
mrb i -j4
76 5 Herbert Greenlee
mrb t -j4
77 5 Herbert Greenlee
</pre>  
78 5 Herbert Greenlee
When you are done updating the release branch, commit updates to your local repository.
79 5 Herbert Greenlee
<pre>
80 5 Herbert Greenlee
cd $MRB_SOURCE/<package>
81 5 Herbert Greenlee
git commit
82 5 Herbert Greenlee
</pre>
83 5 Herbert Greenlee
84 5 Herbert Greenlee
Use git flow to "finish" the release branch.
85 5 Herbert Greenlee
86 5 Herbert Greenlee
<pre>
87 5 Herbert Greenlee
git flow release finish -m"v03_08_02" v03_08_02
88 5 Herbert Greenlee
</pre>
89 1 Herbert Greenlee
This command does the following actions.
90 6 Herbert Greenlee
91 5 Herbert Greenlee
* Merges release branch to master.
92 5 Herbert Greenlee
* Merges release branch to develop.
93 5 Herbert Greenlee
* Creates a tag on the master branch.
94 1 Herbert Greenlee
* Deletes the release branch.
95 6 Herbert Greenlee
* Checks out the develop branch.
96 5 Herbert Greenlee
97 5 Herbert Greenlee
Now push everything up to main repository.
98 1 Herbert Greenlee
<pre>
99 5 Herbert Greenlee
git push origin develop master
100 6 Herbert Greenlee
git push v03_08_02                # Or git push --tags
101 2 Herbert Greenlee
</pre>