美文网首页git
git 获取tags

git 获取tags

作者: 谢昆明 | 来源:发表于2017-03-07 18:36 被阅读90次

    Say you have a project and have been tagging particular points of it on the command line using

    git tag -a v1.0 -m 'tagging Version 1.0'

    Sometime later you’d like to go back to such a tag. This is how we can do that.

    First, commit your current changes so that you’re free to checkout anything new without losing your hard work. Then simply type

    git checkout tags/v1.0

    assuming that v1.0 is the name of your tag. Sometimes you may want to checkout this tag and create a new branch while you’re at it, so that your current branch won’t be overwritten. Thankfully we can do this by issuing

    git checkout tags/v1.0 -b NewBranch

    This will create a new branch called NewBranch and checkout tag v1.0. Once you’re done working on it you can go back to another branch (for example master) by issuing

    git checkout master

    Notice that to switch to other branches you only need to give the branch name – unlike with tags which need to be prefixed with ‘tags/’ as shown above.

    打赏

    如果这篇文章解决了您的问题,让我买根烟抽抽。

    支付宝.jpg 微信.jpg

    相关文章

      网友评论

        本文标题:git 获取tags

        本文链接:https://www.haomeiwen.com/subject/wdtvgttx.html