立诚勿怠,格物致知
It's all about connecting the dots

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》
文章链接:https://www.orzzone.com/git-version-rollback.html
商业联系:yakima.public@gmail.com
本站内容仅供个人学习交流,不做为任何投资、建议的参考依据,因此产生的问题需自行承担。

评论 抢沙发

大前端WordPress主题 更专业 更方便

支持快讯、专题、百度收录推送、人机验证、多级分类筛选器,适用于垂直站点、科技博客、个人站,扁平化设计、简洁白色、超多功能配置、会员中心、直达链接、文章图片弹窗、自动缩略图等...

去看看

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

非常感谢你的打赏,我们将继续给力提供更多优质内容!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册