2

Not sure there´s a solution to this:

I accidentally staged a directory with:

git add * 

then, upon seeing this, I did (major, major mistake, should have of course unstaged)

git rm -r my_directory 

To top it all, I followed up with:

git commit -m ¨horrible commit¨ 

Now the files are nowhere to be found. Is there a way to recover the files?

Thanks

1

1 Answer 1

1

If I'm not mistaken, the git rm shouldn't have deleted this directory but complained:

error: the following file has changes staged in the index: my_directory (use --cached to keep the file, or -f to force removal) 

So the directory should still be there...

If you ran it with -f, sorry, then I guess there's nothing you can do.

Sign up to request clarification or add additional context in comments.

1 Comment

Ah! indeed, thanks for your message. That indicated me that I had actually committed a previous version with the directory in there, that´s why it did not complain!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.