I\'m trying to nail down a good system for release management, combined with the tagging practice of tagging with version numbers - for example, 1.0. Any changes after that
In Git you don’t tag branches. You tag commits. If you want to “mark” a branch you already got that: the name of the branch. :)
Yes, git describe
gives you commit identifiers like 1.0-2-g1ab3183
but those are not tags! Tagging is done with git tag
(who’d have guessed), and the tags that are created using git tag
are the base for the commit identifiers git describe
creates.
In git a tag is an alias for a specific commit, not for a branch.
Tags and branches are independent.
So if you want to checkout a specific version to do a minor rev on it then you could do:
git checkout -b new_branch_name commit_id
Or,
git checkout -b new_branch_name tag_name
Both are simply equivalent ways of referring to a specific commit.
Make your changes, commit them and tag the commit with the minor rev.
You could then even delete the branch that you checked out.
In Git you cannot say that some commit belongs to some branch. Single commit can be on more than one branch; if commit A is one of ancestors of tip of branch, we say that it is on given branch.
As Bombe said in Git you don't tag branches. You tag commits. In Git tag is just (annotated) pointer to a commit.
In your case you have, I think, something like the following
/-- [v1.0] v ---.---.---.---X---.---A <-- master \ \-.---B <-- maint
Let's commit 'X' be comit pointed by tag 'v1.0'. This commit is both on branch 'master' and on branch 'maint'. If you run "git describe" on top of commit 'A' (top of 'master' branch) you would get something like v1.0-2-g9c116e9
. If you run "git describe" on top of commit 'A' ('maint' branch) you would get something like v1.0-2-g3f55e41
(at least with default git-describe configuration). Note that this result is slightly different. v1.0-2-g9c116e9
means that we are at commit with sortened SHA-1 id of 9c116e9
, 2 commits after tag v1.0
. There is no tag v1.0-2
!
If you want for tag to appear only on branch 'master', you can create new commit (e.g. only update default / fallback version information in GIT-VERSION-FILE) after branching point of 'maint' branch. If you tag commits on 'maint' branch with e.g. 'v1.0.3` it would be visible only from 'maint'.
HTH