bring git repo up to a certain revision

前端 未结 1 492
无人共我
无人共我 2021-02-15 17:11

I have a git repo, and a revision code I want it to get my local clone to. How can I bring it up to a specific revision and get rid of any changes I\'ve made?

相关标签:
1条回答
  • 2021-02-15 17:57

    Checkout the branch you want to mess with. Find the revision that you want in the log, then do:

    $ git reset --hard abcd93
    

    With abcd93 being whatever version you found in the log. Note though, that this will change the branch pointer.

    It is usually best to spawn off a new branch, so consider

    $ git checkout abcd93 -b new_branch_name
    
    0 讨论(0)
提交回复
热议问题