撤消git pull [英] Undo a git pull

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

问题描述

我所看到的解决git问题与我的问题略有不同。



这就是我所做的:

目录中有一个项目 A (不是回购)。我初始化了一个存储库,添加了这些文件,但没有提交任何内容。然后我从存储库B中取出,这个存储库重写了我的一些上传文件。

我的印象是我可以使用 git reset --hard 来撤消合并。当然,这只是检查了我刚刚提交的提交的头部。



在进行这次拉动之前,我应该分支并提交一些东西,事后看起来不错。有没有什么办法可以让我以前的unstaged文件恢复?

解决方案

看起来这里有一个恢复阶段文件的答案:



执行git reset后恢复添加的文件--hard HEAD ^


The questions I've seen for undoing a git pull a slightly different to mine.

This is what I've done:

There is a project in directory A (not a repo). I initialized a repository in it, added the files, but did not commit anything. Then I pulled from repository B, which overwrote a bunch of my staged files.

I was under the impression I could use git reset --hard to undo the merge. Of course that just checked out the HEAD of the commits I had just pulled in.

I should have branched and commited something before I did this pull, hindsight is nice. Is there some way I can get my old unstaged files back?

解决方案

It seems there is an answer to recovering staged files here:

Recovering added file after doing git reset --hard HEAD^

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

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