Project

General

Profile

Tagging » History » Version 2

Herbert Greenlee, 10/29/2014 04:50 PM

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 2 Herbert Greenlee
First, checkout master and get your local copy of master up to date with the main repository.
8 2 Herbert Greenlee
<pre>
9 2 Herbert Greenlee
git checkout master
10 2 Herbert Greenlee
git pull
11 2 Herbert Greenlee
</pre>
12 2 Herbert Greenlee
13 2 Herbert Greenlee
Then update master with changes from develop or other source branch.
14 2 Herbert Greenlee
<pre>
15 2 Herbert Greenlee
git merge develop
16 2 Herbert Greenlee
</pre>
17 2 Herbert Greenlee
18 2 Herbert Greenlee
At this point, you can make further changes to your master branch, including the version number stored in product_deps.  When you are done updating master, commit and push your changes to the main repository.
19 2 Herbert Greenlee
<pre>
20 2 Herbert Greenlee
git commit
21 2 Herbert Greenlee
git push origin master
22 2 Herbert Greenlee
</pre>
23 2 Herbert Greenlee
24 2 Herbert Greenlee
Now make the actual tag and push the tag to the main repository.
25 2 Herbert Greenlee
<pre>
26 2 Herbert Greenlee
git tag -a -m"v02_05_01" v02_05_01   # Annotated tag.
27 2 Herbert Greenlee
git push origin v02_05_01            # Or git push --tags
28 2 Herbert Greenlee
</pre>
29 2 Herbert Greenlee
If you want to move an existing tag, you need to add option @-f@ or @--force@ to the last two commands.
30 2 Herbert Greenlee
31 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.
32 2 Herbert Greenlee
<pre>
33 2 Herbert Greenlee
git checkout develop
34 2 Herbert Greenlee
git merge master
35 2 Herbert Greenlee
git push origin develop
36 2 Herbert Greenlee
</pre>