accidentally committed in git

Possible Duplicate:
Git undo last commit

I have a folder structure like this..

~/git
     ......all repos of my github account
     .....play
     .....emacs.d
     .....dummy
     .....etc

i have created dummy repo to get familiar with git commands. so instead of initializing dummy folder,i have issued git init in git folder and issued git add . ,and committed to my local repo.

I want to go back to my previous state,and do not want to loose any changes i have done. How can i do that?


I assume your ~/git folder was no git repo before? Simply delete the .git folder and everything is like it was before.

All repos (play, emacs.d etc) still have their individual .git folders and are complete repos..

The only thing you did was init another git repo that is now also tracking the other repositories (including their .git folder contents)


只需在git中删除.git文件夹,下面的所有文件夹都可以。


The repository will be in the .git directory. Delete that and this will no longer be a repository. You won't lose anything in the working copy.

链接地址: http://www.djcxy.com/p/572.html

上一篇: 改变已经推送的git commit

下一篇: 意外地在git中犯下