本文介绍了Git拉删除了未提交的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在github上创建了一个新的存储库。从一个文件夹开始,我做的步骤是:

I just made a new repository on github. Starting with a folder full of files, the steps I did were:

git init
git add -A
git remote add origin ...

#Now pull in the first commit that github made
git pull origin master

#Check everything is OK
ls

Eek!我的所有文件都消失了!发生了什么?我可以让他们回来吗?

Eek! All my files have disappeared! What happened? Can I get them back?

推荐答案

你可以让他们回来。尽管唯一指向它的是索引,但是 git add 仍然会将添加的内容放入回购中。我将从一个 git fsck 开始寻找dangling(git有点古怪拼写unreferenced)blob和 git cat-file -p 那些blob,如果太多,我会做一些像 find .git / objects -type f | xargs ls -lt

You can get them back. Even though the only thing pointing to it was the index, git add still put the added content in the repo. I'd start with a git fsck to find "dangling" (git's slightly quirky spelling of "unreferenced") blobs and git cat-file -p those blobs, if there's too many I'd do something like find .git/objects -type f | xargs ls -lt.

这篇关于Git拉删除了未提交的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 03:55