I ran the following set of commands inside my local repo (branch develop
) to try to git a subdirectory (assets/App
) in my project to link to a remote repo's App
directory, so that when they update code, I can get those updates without having to copy/paste from a clone:
git remote add durandal git://github.com/BlueSpire/Durandal.git
git fetch durandal #now I have a remote branch with all of Durandal
git checkout -b durandal durandal/master #now I have a local branch with the contents of durandal/master and have switched to it
git config core.sparsecheckout true #trying some sparse-checkout stuff, not really understanding what I'm doing
echo App/ > .git/info/sparse-checkout
git checkout develop #back in my develop branch
git read-tree --prefix=assets/App/ -u durandal #all hell breaks loose
At this point, all my files were gone from branch develop
except for assets/App/
(and those files that were in .gitignore
) which now has the contents copied from the durandal branch
App folder. I immediately ran git reset --hard
to no avail. I tried resetting with a sha. Nope. I tried pulling from my dropbox remote that should have had everything backed up. Same deal. I tired switching to master and all the files were gone from there too, which I completely don't understand. I can't see how to recover.
I know I should not have done this without really understanding what I was doing but can someone help me get my repo back to where it was prior to my experiment? Secondarily, what did I do to cause this and how might I accomplish what I was trying to do?