Want to change my master to an older commit, how can I do this?

前端 未结 7 1863
栀梦
栀梦 2020-12-12 11:21

I want to rollback to a previous commit, and then publish that code, then go back to the latest commit.

i.e. so my master is pointing to an older commit version just

相关标签:
7条回答
  • 2020-12-12 12:07

    You can just git checkout <commit-id>, do whatever you need to do, then git checkout master to get back to the new code.

    If you actually need to modify the old code to release it, then you should probably:

    git checkout -b my_release <commit-id>
    ... prepare code for release ...
    ... release code ...
    git checkout master
    git merge my_release
    

    Also, I can't recommend git flow enough. It makes all of this quite easy.

    0 讨论(0)
提交回复
热议问题