Well, a sad thing happened to me recently, and the trouble is, I could have done a few different things to prevent it. I even had a little warning time which should have prompted me to affirm certain redundancies. Doing so would have saved my data, and more importantly, saved myself from a really big headache. Alas, I ignored the warning signs of a corrupt drive.

My nice little 64GB Patriot Slider USB3.0 drive choked on me. )`; I truly was not prepared for the catastrophe, especially since I had been keeping all my bare git repositories on it. It was my little thumb-sized git server. To compound the problem, I did the foolish thing of deleting the local repositories I wasn't working on from my local drive.

Git commands that helped me start over

git init my/awesome-repo
When building my local repository
git init --bare my-server/awesome-repo.git
When creating my server repository
git remote add origin my-server/awesome-repo.git
To connect the local repository to my server repository
git remote -v
To check the location of a remote
cd local-repository
git remote set-url origin my-server/repo.git
To reconnect to a different server repository
git fetch origin
To fetch changes to the local repository from my server repository
git push --set-upstream origin new-branch
To push a new branch to the remote repository
git push
To push changes from my current branch to the remote repository
git clone --mirror https://github.com/enyojs/enyo.git
To mirror another server's repository locally
git remote update
To update the mirror
cd new-location
git clone my-server/dir/repo.git
When cloning my server repository in a new location
git submodule update --init
To initialize any submodules after a clone
git submodule add ../../base/repo.git lib/repo
To add a submodule as needed