返回某些先前的提交,并且不修改git历史记录 [英] Going back to certain previous commit and not modifying git history

查看:70
本文介绍了返回某些先前的提交,并且不修改git历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要返回到某些提交,这是我当前提交之前的7个提交.如果这样做,我想将所有文件更改为完全像以前的提交一样.但是我不想删除github中的git commit历史记录.如何保留历史记录并回到以前的状态?

I need to go back to certain commit which is 7 commits before my current commit. If I do, I want to change all files to exactly look like previous commit. But I don't want to erase git commit history in github. How do I keep the history and go back to previous state?

谢谢.

推荐答案

尝试一下:

 git checkout <commit>

这篇关于返回某些先前的提交,并且不修改git历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆