Faster, Higher, Stronger
更快,更高,更强

git version rollback

First, get commit id:

tengyunfengdeMacBook-Pro:test-git yakima$ git log
commit 25c92d1f05c56827b306689f426278e1cba8e837
Author: Yakima <cleveryun@163.com>
Date:   Mon Jul 31 10:24:00 2017 +0800

    third commit

commit 13d46518f355aa88e85979d616203748c38dde33
Author: Yakima <cleveryun@163.com>
Date:   Mon Jul 31 10:23:35 2017 +0800

    second commit

commit 0b01db0d3923ec3cfa8b643286ff9333c20cc5de
Author: Yakima <cleveryun@163.com>
Date:   Mon Jul 31 10:21:59 2017 +0800

    first commit

Then, roll back local version:

tengyunfengdeMacBook-Pro:test-git yakima$ git reset --hard 13d46518f355aa88e85979d616203748c38dde33
HEAD is now at 13d4651 second commit

And, check results of local rolling-back:

tengyunfengdeMacBook-Pro:test-git yakima$ git log
commit 13d46518f355aa88e85979d616203748c38dde33
Author: Yakima <cleveryun@163.com>
Date:   Mon Jul 31 10:23:35 2017 +0800

    second commit

commit 0b01db0d3923ec3cfa8b643286ff9333c20cc5de
Author: Yakima <cleveryun@163.com>
Date:   Mon Jul 31 10:21:59 2017 +0800

    first commit

Finally, roll back online version:

tengyunfengdeMacBook-Pro:test-git yakima$ git push -f
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/Yakima-Teng/test-git.git

 

赞(0) 打赏
未经允许不得转载:峰间的云 » git version rollback

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏