Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

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?

share|improve this question

marked as duplicate by George Stocker Jul 22 '12 at 2:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
You don't want to loose all your previous history in that repository or changes from the last commit you accidentally commited into it? Or both? – KL-7 Dec 28 '11 at 16:09
up vote 6 down vote accepted

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)

share|improve this answer
    
it was not...... – Srinivas Reddy Thatiparthy Dec 28 '11 at 16:08
    
Then just delete the .git folder. – Tigraine Dec 28 '11 at 16:09

Just remove the .git folder in git, all the folders underneath will be fine.

share|improve this answer

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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.