Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a new branch from a tag?

I'd like to create a new master branch from an existing tag. Say I have a tag v1.0. How to create a new branch from this tag?

like image 221
Andrew Avatar asked Jun 07 '12 22:06

Andrew


People also ask

Can I create a branch from a tag?

The best way to work with git tags is to create a new branch from the existing tag. It can be done using git checkout command.

How do I merge a tag into a branch?

Then you can perform git merge tag_name to merge the tag onto a branch. I had to do git remote add upstream [email protected]/org/repo followed by git fetch --tags upstream to make it work.

How do I create a new tag in git?

In order to create a new tag, you have to use the “git tag” command and specify the tag name that you want to create. As an example, let's say that you want to create a new tag on the latest commit of your master branch. To achieve that, execute the “git tag” command and specify the tagname.


2 Answers

Wow, that was easier than I thought:

git checkout -b newbranch v1.0 
like image 114
Andrew Avatar answered Sep 21 '22 10:09

Andrew


If you simply want to create a new branch without immediately changing to it, you could do the following:

git branch newbranch v1.0 
like image 21
Thamaraikani Avatar answered Sep 21 '22 10:09

Thamaraikani