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?
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.
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.
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.
Wow, that was easier than I thought:
git checkout -b newbranch v1.0
If you simply want to create a new branch without immediately changing to it, you could do the following:
git branch newbranch v1.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With