Hi,
I was a bit hasty the other day and did something stupid. I added a new folder to git annex. Something like
git annex add my-important folder
my-important folder contains a lot of files and it took a couple of minutes to add. When I then tried to do
git commit -am 'added files'
per the walkthrough I got an error (9, as I recall). I thought I'd added too many files or something so I wanted to start over and perhaps I didn't fully understand the mechanisms of annex I did the following
git reset --hard .
Unfortunately, did replaced my files with a bunch of symlinks, rather than making git annex forget and go back to the previous stage as I had hoped.
I have managed to recover most of my files from backup, but some of them I still can't recover. Is there any way back? It seems I still have the files in my git folder.
Thanks, Rasmus
PS: Sorry, I shouldn't have made this text rather than Markdown.
The file contents are still there in
.git/annex/objects/
.When I run
git reset --hard
, it deletes any files that have been added, but not committed. You say you still have symlinks to the content. If so, you can justgit add
the symlinks and be back how git-annex wants things to be.If, instead, you are missing the symlinks, then since you never committed the symlinks to git, there is no record anywhere in git of the filenames that go with the file contents.
What you can do is ask git-annex to put back symlinks to the file contents:
This will make you have a bunch of files in the repository with names starting with "unused". You can then rename them manually.
BTW, I would of course be interested in any error message from
git commit
.Joey,
Thanks for your useful tips and for providing this software. It seems incredibly powerful and useful. I made a copy of the folder which I messed up. I will try the tips and report back (I'm on the road right now).
The other day all the Haskell deps worked out and I managed to build git annex. Hopefully, this will give more reliable results as it seemed that some of my bugs were caused by the 32bit prebuild on 64bit. If I succeed in recreating my files I will try to recreate the error
Joey,
Sorry for asking again, but I haven't been able to resolve this using the symlinks.
Consider this file
The file that the symlink points to doesn't exist. I'm not sure it should. The file with {.map,.cahce} extensions does exist, in this case
The content of the .cache file is
and the content of the .map file is
However, for all of the following
the files are not staged, and I get the message usual
with
git log
.So do I need to something more in order to get
git
to add my symlinks?If you
git add
a file andgit commit
says "no changes added to commit", what would you think would be the reason?I'd think it was because the file was already committed to git. So that must be the case with your symlink.
You seem to have told git-annex to do something to the content of that file. You could use
git annex whereis
to find where it is, orgit annex get
to get it. (Assuming you have not usedgit annex drop --force
on the file to nuke its content earlier.)I think the problem is more severe as all of the files have somehow ended up in the .git/objects folder. I have no idea how, but I have been unsuccessful with both methods (the second methods gives me
which I guess is related to the fact that my files somehow ended up in the git objects folder rather than the git annex objects folder.
I appreciated the help.
Cheers, Rasmus