views:

16

answers:

1

it had a existing git checkout and had made some modifications, then i checked out the same repo and it overwrote the folder. Is there some way to get the old repos with the uncommitted changes?

I had checked " git reflog --all " but it only gave me the most recent checkout.

A: 

That would happen with a git checkout -f
(--force: When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes)

But it shouldn' be the case with a git clone on the same repo:

fatal: destination path 'myrepo' already exists and is not an empty directory.

If you did a git checkout -f, any changes added or private (not yet added) will be lost.

VonC
My guess is the title is a mistake, and this is all the result of an attempt to carry over "check out" from the centralized VCS world...
Jefromi
ok these are the steps:1) git clone <repo> 2) cd <repo> 3) <make local modifications but do not commit them> 4) cd .. 5) git clone <branch-of-repo1> 6) now, the <repo> folder gets overwritten what i should have done is checkout a remote but i did not do that :-)
deepak
@deepak: that is strange because: a/ `git clone <branch-of-repo1>` doesn't exist as a valid syntax. b/ any clone of any sort in an non-empty directory will be canceled (see my error message in my answer)
VonC
@VonC: i cannot reproduce it again. Previously i had done a 'git pull' and had got an error. Will comment if i can recreate the issue. Thanks.
deepak