撤消git pull --rebase吗? [英] Undo a git pull --rebase?

查看:396
本文介绍了撤消git pull --rebase吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚跑

git pull --rebase

,忘记指定来源".看起来git从所有不同的分支中拉出.有没有办法从这里还原我的仓库以撤消拉动?

and forget to specify "origin". It looks like git pulled from all different branches. Is there a way to revert my repo from here to undo the pull?

谢谢

推荐答案

git pull操作之后,ORIG_HEAD应指向HEAD的先前值.您应该能够:

After a git pull operation, ORIG_HEAD should point to the previous value of HEAD. You should be able to:

git reset --hard ORIG_HEAD

并返回pull操作之前的起点.您可以运行:

And be back where you started before the pull operation. You can run:

git show ORIG_HEAD

在运行reset命令之前准确查看ORIG_HEAD指向的位置.

To see exactly where ORIG_HEAD is pointing prior to running the reset command.

另一种解决方案是基于ORIG_HEAD创建新分支:

An alternative solution would be to create a new branch based on ORIG_HEAD:

git checkout -b newbranch ORIG_HEAD

验证一切看起来与您期望的一样,然后删除旧分支并重命名new branch.

Verify that things look the way you expect, then delete the old branch and rename new branch.

另请参阅此问题,以获取对HEADORIG_HEAD和用于指代同一事物的备用语法.

Also see this question for a discussion of HEAD and ORIG_HEAD and alternate syntaxes for referring to the same thing.

这篇关于撤消git pull --rebase吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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