相关疑难解决方法(0)

6561
推荐指数
33
解决办法
214万
查看次数

如何在不移动HEAD的情况下重置工作树?

鉴于git分支上有一些提交(C是最近的提交):

A -> B -> C
Run Code Online (Sandbox Code Playgroud)

如何重置我的工作区,以便所有文件都处于它们在提交B的状态,但HEAD仍在C?

我看过了git-reset,但没有一个选项似乎有帮助.手册页建议所有不同的模式将移动HEAD:

--soft
   Does not touch the index file or the working tree at all 
   (but resets the head to <commit>, just like all modes do).
Run Code Online (Sandbox Code Playgroud)

我试过了,git reset HEAD~但这会让HEAD感动.

git

4
推荐指数
2
解决办法
1060
查看次数

标签 统计

git ×2

branch ×1

git-branch ×1