我删除了整个项目设置我的git repo。我能做些什么吗?

时间:2016-01-22 14:09:06

标签: git repository bitbucket

我打开了Time Machine,但事实证明我没有设置它。所以这个选项就出来了。

我打开我的垃圾箱,它不在那里。所以这个选项就出来了。

这就是我的所作所为。

我在bitbucket上有一个现有的回购。这是很久以前的事了。

我最近开始了另一个项目,并决定将它放在bitbucket上。

我在bitbucket,并且错误地试图跟随"我有一个现有的项目"而不是"我从头开始"。

所以我永远不会创建一个新的git repo。我去了我的项目目录并执行了以下操作......

git remote add origin git@bitbucket.org:myusername/myproject.git
git push - u origin --all

No refs in common and none specific: doing nothing
Perhaps you should specify a branch such as master
fatal: The remote end hung up unexpectedly 
Everything up to date

git status

At this point I noticed not just my intended project were staged, but a bunch of other examples, demos, and projects were. Then there were a bunch of files not staged, and a bunch of untracked files.

git add -A
git status

At this point, just about everything was staged. Whoops. What the heck am I doing.

ls -al

I beginning look for the .git file realizing now I never created it, as I followed the wrong steps on bitbucket.

git reset --hard

I decide to just reset everything, in a lapse of judgement.  

现在一切都消失了。垃圾箱中没有文件,没有Time Machine的选项。明显没有bitbucket。

我有哪些选择?从头开始?为什么垃圾箱里没有任何东西?

2 个答案:

答案 0 :(得分:0)

你的旧回购还没有留在bitbucket上吗?我假设你没有设法把任何东西推到bitbucket你删除的文件是你的bitbucket repo的本地副本。如果是这样,那么你应该能够再次从bitbucket克隆你的回购。

关于垃圾箱,使用Finder时只会将垃圾放入垃圾箱,应用程序删除的文件和直接使用rm的文件将始终只与文件系统断开连接而不会显示在垃圾箱中。如果情况并非如此,那么您的垃圾箱可能会充满您的操作系统和应用程序在运行时创建的临时文件。

希望你能恢复你的工作。

答案 1 :(得分:0)

如果您能够在文件夹中运行git命令,则必须已初始化存储库。

您可以结帐的reflog中是否有任何提交?:

git reflog

如果你看到一个状态,你想恢复复制哈希并检查它:

git checkout c49b4a7

希望这有帮助!

相关问题