Project

General

Profile

Tagging » History » Version 3

Herbert Greenlee, 12/11/2014 01:02 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 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 3 Herbert Greenlee
git checkout develop
10 3 Herbert Greenlee
git pull
11 2 Herbert Greenlee
git checkout master
12 2 Herbert Greenlee
git pull
13 2 Herbert Greenlee
</pre>
14 2 Herbert Greenlee
15 2 Herbert Greenlee
Then update master with changes from develop or other source branch.
16 2 Herbert Greenlee
<pre>
17 2 Herbert Greenlee
git merge develop
18 2 Herbert Greenlee
</pre>
19 2 Herbert Greenlee
20 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.
21 2 Herbert Greenlee
<pre>
22 2 Herbert Greenlee
git commit
23 2 Herbert Greenlee
git push origin master
24 2 Herbert Greenlee
</pre>
25 2 Herbert Greenlee
26 2 Herbert Greenlee
Now make the actual tag and push the tag to the main repository.
27 2 Herbert Greenlee
<pre>
28 2 Herbert Greenlee
git tag -a -m"v02_05_01" v02_05_01   # Annotated tag.
29 2 Herbert Greenlee
git push origin v02_05_01            # Or git push --tags
30 2 Herbert Greenlee
</pre>
31 2 Herbert Greenlee
If you want to move an existing tag, you need to add option @-f@ or @--force@ to the last two commands.
32 2 Herbert Greenlee
33 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.
34 2 Herbert Greenlee
<pre>
35 2 Herbert Greenlee
git checkout develop
36 2 Herbert Greenlee
git merge master
37 2 Herbert Greenlee
git push origin develop
38 2 Herbert Greenlee
</pre>