如何将Git存储库回滚(重置)到特定的提交? [重复]

落爺英雄遲暮 提交于 2020-05-02 10:06:14

问题:

This question already has an answer here: 这个问题在这里已有答案:

I cloned a Git repository and then tried to roll it back to a particular commit early on in the development process. 我克隆了一个Git存储库,然后尝试在开发过程的早期将其回滚到特定的提交。 Everything that was added to the repository after that point is unimportant to me so I want to omit all subsequent changes from my local source code. 在该点之后添加到存储库的所有内容对我来说都不重要,因此我想省略本地源代码中的所有后续更改。

However, when I try to roll back in the GUI tool it doesn't update my local file system - I always end up with the latest source code for the project. 但是,当我尝试回滚GUI工具时,它不会更新我的本地文件系统 - 我总是最终得到项目的最新源代码。

What's the correct way to just get the source for a repository as of a particular commit in the project's history and omit all later updates? 从项目历史中的特定提交中获取存储库的源代码的正确方法是什么,并省略所有后续更新?


解决方案:

参考一: https://stackoom.com/question/6mdx/如何将Git存储库回滚-重置-到特定的提交-重复
参考二: https://oldbug.net/q/6mdx/How-do-you-roll-back-reset-a-Git-repository-to-a-particular-commit-duplicate
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!