本文介绍了暂时将工作副本切换到特定的Git提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何切换到特定的Git提交而不会丢失所有提交的提交

How to switch to specific Git commit without losing all the commits made after it?

我希望本地文件将被更改,但提交'数据库将保持不变,只有当前位置指针设置为当前选定的提交。

I want that local files will be changed, but commits' database will remain intact, only the current position pointer is set to currently selected commit.

我想将文件的状态更改为特定的提交,运行项目,完成后,恢复文件返回上次提交。

I want to change files' state to specific commit, run project and, when finished, restore files back to last commit.

如何在不压缩整个项目文件夹的情况下执行此操作?

How to do this without zipping the whole project's folder?

推荐答案

如果您位于某个分支 mybranch ,请继续前进, git checkout commit_hash 。然后你可以通过 git checkout mybranch 返回你的分支。我今天有同样的游戏平分错误:)另外,你应该知道。

If you are at a certain branch mybranch, just go ahead and git checkout commit_hash. Then you can return to your branch by git checkout mybranch. I had the same game bisecting a bug today :) Also, you should know about git bisect.

这篇关于暂时将工作副本切换到特定的Git提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 17:32