简体   繁体   中英

Git tag on master branch pointing to merge commit — not available from develop branch

I'm pretty new to gitflow: I've merged my develop branch into my master branch and created a tag, but the tag is pointing to the merge commit so origin/master is one commit ahead of origin/develop .

I have a jenkins job pulling down the develop branch and git describe gets the previous available tag instead of the new one.

I'd like origin/develop and origin/master to be at the same place after merging from develop into master, or at least the tag to be available from both branches. Should I create the tag on develop before merging, or is there a better way?

After a merge to master , master will indeed be be one commit ahead of develop , and it is impossible for them to both be at the same place (due to the merge itself being considered a commit). Despite master being one commit ahead, both branches will contain identical code.

Tagging should be done against master ; the tag should be indicative of the last version or release . Ideally it would be made against a release branch, though in the absence of one, master is the more suitable option (as it is meant to indicate a 'stable' point in time).

It is worth mentioning, however, that you can create a tag retroactively if need be with:

$ git tag -a {tag} {commit}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM