So suppose you put an existing folder under git-annex control, like this:
cd Archive_of_all_my_files
git init .
git annex init "Archive Folder"
git annex add .
And now you forget the last step:
git commit -am "init"
Instead, you fool around with git. After all, isn't git designed to keep your data safe and make sure there's no way you can accidentally lose it? The only branch that exists is 'git-annex', so you switch to that branch to see what it is:
git checkout git-annex
This command switches to the branch git-annex and makes a mess in the working directory. And you can't switch back to master since master does not have any commits. Is there a clean way to go back? I tried 'git checkout --orphan master', but the messy files stayed in the working directory. In the meantime, there should probably be a warning on the walkthrough page.
I think git / git annex should warn you before switching the branch in this rare situation.
Yes, any git repository where there has not been an initial commit made is in an unusal situation. I've often felt this is a design flaw of git; it could start off with an empty root 00000 commit and avoid this complexity.
There are probably all kinds of fancy git commands that can be used to get out of the situation you describe, but finessing a perfect exit from a situation that has happened in the first 5 minutes of using a new repository seems like overkill. Just run
git annex unannex
to move all your files out of git-annex; rungit rm -rf .
to delete the files from the git-annex branch; runrm -rf .git
, and you're back where you started with some files and no git repository.... And no, neither git nor git-annex make any promises about keeping your data secure until you have both committed it and sent it somewhere else.
Thanks for your helpful response. The cleaning procedure that you propose is perfectly fine.
I wasn't suggesting to put up a big warning sign; I just feel like the walkthrough would be a little smoother if it explained something like: hey, 'git annex add .' just moved all of your precious files to '.git/annex/' and renamed them in a way that may scare you. But don't worry: if, at any point, you want to get them out again and put them back in their original place, just run 'git annex unannex'.
I've had this a few times (or situations very similar).
is now always followed by
.. which I should really set as an alias