Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tag for release branch on both develop and master branch?

Tags:

git

I am trying to determine the best way to finish-off a release branch in git. I would like to take it so we could easily go back if we need to. So when I do my merge to the develop branch I create a tag and push it to the remote like so:

Tag this release
$ git tag -a "v1.6" -m "Release v1.6"
Push to remote
$ git push origin develop --follow-tags

Which appears to work great. However, I also need to merge to master and would like to take it there for the same reason. When I attempt to create the tag on release I obviously get a conflict. So, up to now I have been creating a tag like so:

$ git tag -a "v1.6-master" -m "Release v1.6"

This works fine but it seems like there should be a way to just create a tag and be able to checkout that tag on whatever branch you happen to be on. I feel like I am missing something essential.

like image 355
Bert Alfred Avatar asked Jun 26 '17 16:06

Bert Alfred


People also ask

Does git tag apply to all branches?

Yes! The difference between a branch name and a tag name is that a branch name is expected to move, and git will move it automatically in that "on a branch" case.

What is the master branch and release branch for?

Master is a permanent branch which always reflects a production-ready state. So yes, it is for ready-product which can be downloaded on the market by user. Release is a temporal supporting branch to support preparation of a new production release.


2 Answers

With Git, it is a commit, not a branch, that gets tagged. Depending on your workflow, the same commit could exist in both master and develop. However, given you have those two branches, it is likely that a (merge) commit to master signifies a release. In that case, the proper thing to do would be to tag that merge commit to master.

like image 132
Jamie Bisotti Avatar answered Nov 16 '22 02:11

Jamie Bisotti


Sounds pretty similiar to git flow. Did you have a look on it already?

  • http://nvie.com/posts/a-successful-git-branching-model/
  • https://danielkummer.github.io/git-flow-cheatsheet/index.de_DE.html
  • https://github.com/petervanderdoes/gitflow-avh

The first two are the original branching model. The last one is the current development that you can also find in your favorite linux repository. It adds support branches for older versions that you need to support obviously.

like image 28
Hoall Avatar answered Nov 16 '22 02:11

Hoall