How to create a new branch from a tag?

后端 未结 7 2161
不思量自难忘°
不思量自难忘° 2020-12-12 08:56

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?

7条回答
  •  情深已故
    2020-12-12 09:28

    An exemple of the only solution that works for in the simple usecase where I am on a fork and I want to checkout a new branch on a tag that is on the main repository ( here upstream )

    git fetch upstream --tags
    

    Give me

    From https://github.com/keycloak/keycloak
       90b29b0e31..0ba9055d28  stage      -> upstream/stage
     * [new tag]    11.0.0     -> 11.0.0
    

    Then I can create a new branch from this tag and checkout on it

    git checkout -b tags/

    git checkout tags/11.0.0 -b v11.0.0
    

提交回复
热议问题