Accidentally deleted the .git folder

荒凉一梦 提交于 2020-01-03 05:54:08

问题


I was following an instruction on Heroku to try to find out the slug size of my app

Your slug size is displayed at the end of a successful compile. You can roughly estimate slug size locally by doing a fresh checkout of your app, deleting the .git directory, and running du -hsc.

$ du -hsc | grep total 2.9M total

By "fresh checkout of your app", I thought it meant just simply do git checkout -b test. So I did that, then i rm -rf .git to delete the .git folder. and did the du -hsc to get my slug size. I did get it, but when I tried to git checkout master. It says I don't have a git repository in this folder. -- Now I do have my app git push to both a location on heroku and a location on github. Is it possible that I can, well, to speak plainly, to make things return to what they were before I deleted the .git folder?

Thank you for helping out!


回答1:


I'm not sure if I understand exactly what you mean but it sounds like you can just git clone to get it back.

Two options:

1. if you have remotes you can just clone it again.

(OR)

2. If you have non committed changed locally then move them, do your clone, copy the changed files back into the directory, then commit and push.



来源:https://stackoverflow.com/questions/10526849/accidentally-deleted-the-git-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!