如何从失败的检出中恢复并弄乱当前分支 [英] How to recover from failed checkout and messed up current branch

查看:46
本文介绍了如何从失败的检出中恢复并弄乱当前分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将分支切换到上一个分支(P),但是命令失败,现在我的一些 源来自当前分支(C),而其他源则来自我希望的分支P切换到并且正式地"我仍然在分支C中.如何清除因结帐失败而导致的混乱,并将分支C恢复到最后一次提交.

I tried switching branches to a previous branch (P) but the command failed and now some of my sources are from the current branch (C) while the others are from the branch P that I hoped to switch to; and 'officially' I am still in branch C. How can I clear up the mess caused by the failed checkout and revert branch C to the last commit.

推荐答案

删除所有文件,运行

git reset --hard HEAD

注意:未跟踪的文件将丢失

NOTE: Untracked files will be lost

这篇关于如何从失败的检出中恢复并弄乱当前分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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