Git: How to create a new branch from a tag?

匿名 (未验证) 提交于 2019-12-03 00:46:02

问题:

Something happened and our master branch got all screwed up. Rather than spending the time trying to figure out what went wrong, I just want to create a new master branch from an existing tag. So if my tag is v1.0, how do I create a new branch from this tag?

回答1:

Wow, that was easier than I thought:

git checkout -b newbranch v1.0 


回答2:

git branch newbranch v1.0 

The above command will just create the new branch, not check it out.



回答3:

I have resolve the problem as below 1. Get the tag from your branch 2. Write below command

Example: git branch      git branch hotfix_4.4.3 v4.4.3     git checkout hotfix_4.4.3 

or you can do with other command

git checkout -b  -b stands for creating new branch to local  

once you ready with your hotfix branch, It's time to move that branch to github, you can do so by writing below command

git push --set-upstream origin hotfix_4.4.3 


回答4:

My branch list (only master now)

My tag list (have three tags)

Switch to new branch feature/codec from opus_codec tag

git checkout -b feature/codec opus_codec 



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!