如何恢复删除的文件 [英] How to bring back removed file

查看:111
本文介绍了如何恢复删除的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GIT工作仓库中,我用命令rm -rf删除了几个文件,而不是git rm,当我试图从服务器(裸回购)中拉/取文件不可见时。我怎么把这些文件带回来?

In GIT working repo i removed couple of files with command rm -rf not git rm, When i try to pull/fetch from the server(bare repo) files are not visible. How do i bring those file back ?

推荐答案

恢复到以前的提交。这将重置为上次提交状态:

Revert to a previous commit. This will reset to last committed state:

git reset --hard HEAD

请注意...如果您有其他更改...请确保您先存储它们!

Note...if you have other changes...be SURE you stash them first!

git stash

以下是从另一篇文章中选择的选项也可以帮助你:

Here is an option taken from another post that might help you as well:

git checkout abcde file/to/restore

其中abcde是提交#。您可以使用:

Where abcde is the commit #. You can use:

git log

获取提交日志。

使用Git将特定文件重置或恢复到特定版本?

这篇关于如何恢复删除的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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