Project

General

Profile

Tagging » History » Version 4

Herbert Greenlee, 12/18/2014 10:11 AM

1 1 Herbert Greenlee
h1. Tagging a branch for release
2 2 Herbert Greenlee
3 2 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.  A similar procedure is used by the larsoft team to tag larsoft packages.  
4 2 Herbert Greenlee
5 2 Herbert Greenlee
A preliminary step will be to get your local copy of the branch that will be the source of the tag (such as the develop branch) the way you want the released version to be.
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 2 Herbert Greenlee
git checkout develop
44 2 Herbert Greenlee
git merge master
45 2 Herbert Greenlee
git push origin develop
46 2 Herbert Greenlee
</pre>