Branch/master tag revision increments using Git

前端 未结 3 1843
执笔经年
执笔经年 2020-12-18 03:37

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

3条回答
  •  一个人的身影
    2020-12-18 04:06

    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

提交回复
热议问题