I made a disastrous mistake with “create git repo here” - how do I rectify/undo it?

佐手、 提交于 2019-12-29 01:26:30

问题


I am new to Git. I have created an account on Bitbucket and downloaded TortoiseGit.

I'm on Windows 7 and on the desktop I right clicked and thought "add git repo here" would create an empty folder that could be committed, but iy turns out it has **staged ** every folder on the desktop to be committed to master instead.

How do I undo this?


回答1:


Make sure to turn on Show hidden files in Explorer. Then delete .git directory in your desktop




回答2:


Do not run git reset --hard that will delete all the files. Delete the hidden .git folder.

Press Win + R type in cmd and press enter.

cd Desktop
rmdir /S .git



回答3:


Try this

git reset HEAD *

It would unstage all of your files and none of your changes will go away.




回答4:


With TortoiseGit 1.8.7.1, a warning message will be added when creating repository on special folders, such as Desktop, drive root, UNC root, User Profile, Windows Directory, system32, Program Files

The Create Repository menu item may be clicked by mistake.



来源:https://stackoverflow.com/questions/21323884/i-made-a-disastrous-mistake-with-create-git-repo-here-how-do-i-rectify-undo

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