从错误的github存储库中撤消拉 [英] undoing a pull from the wrong github repository

查看:96
本文介绍了从错误的github存储库中撤消拉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从github上拉出来,从错误的github存储库中拖到我的项目中。

I just did a pull from github and pulled from the wrong github repository into my project. How do I undo this?

谢谢!

Thanks!

推荐答案

git reset --hard HEAD^

此命令将您的分支重置为先前的提交,即合并提交之前的提交,这是您要撤消的提交。您的工作将保持不变。

This command resets your branch to the previous commit, that is the commit before the merge commit, which is the one you want to undo. Your work will be left untouched.

请记住,提交的所有东西仍然存在为松散对象,您始终可以使用git reflog来恢复HEAD指出的任何版本到之前。这就是为什么经常使用git非常重要的原因,你可以简单地撤销你所做的所有更改。

Remember that everything that has been commited is still there as loose objects and you can always use git reflog to revert to any version HEAD has pointed to before. This is why it's so important to commit often with git, you can undo all changes you have done with ease.

这篇关于从错误的github存储库中撤消拉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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