Project

General

Profile

Tagging » History » Version 9

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