如何从标签创建新分支?

本文介绍了如何从现有的Git标签创建一个新的分支。通过简单的Git命令,可以轻松地从标签切换到新分支,并进行必要的版本更新,然后将新分支推送到远程仓库。
摘要由CSDN通过智能技术生成

本文翻译自:How to create a new branch from a tag?

I'd like to create a new master branch from an existing tag. 我想从现有标签创建一个新的master分支。 Say I have a tag v1.0 . 说我有一个标签v1.0 How to create a new branch from this tag? 如何从这个标签创建一个新的分支?


#1楼

参考:https://stackoom.com/question/juFR/如何从标签创建新分支


#2楼

哇,这比我想象的要容易:

git checkout -b newbranch v1.0

#3楼

如果您只是想创建一个新分支而不立即更改它,则可以执行以下操作:

git branch newbranch v1.0

#4楼

My branch list (only master now) 我的分支机构列表(现在仅适用于母版

分支机构清单

My tag list (have three tags) 我的标签列表(具有三个标签)

标签清单

Switch to new branch feature/codec from opus_codec tag opus_codec标签切换到新的分支功能/编解码器

git checkout -b feature/codec opus_codec

切换到分支


#5楼

I have resolve the problem as below 1. Get the tag from your branch 2. Write below command 我已经解决了以下问题1.从您的分支机构获取标签2.写以下命令

Example: git branch <Hotfix branch> <TAG>
    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 <Hotfix branch> <TAG>
-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 一旦准备好您的hotfix分支,是时候将该分支移至github了,可以通过编写以下命令来实现

git push --set-upstream origin hotfix_4.4.3

#6楼

I used the following steps to create a new hot fix branch from a Tag. 我使用以下步骤从标签创建新的热修复分支。

Syntax 句法

git checkout -b <New Branch Name> <TAG Name>

Steps to do it. 步骤去做。

  1. git checkout -b NewBranchName v1.0 git checkout -b NewBranchName v1.0
  2. Make changes to pom / release versions 更改pom /发布版本
  3. Stage changes 阶段变更
  4. git commit -m "Update pom versions for Hotfix branch" git commit -m“为修补程序分支更新pom版本”
  5. Finally push your newly created branch to remote repository. 最后,将您新创建的分支推送到远程存储库。
git push -u origin NewBranchName

I hope this would help. 我希望这会有所帮助。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值