About 300 lines of code were deleted from my computer last week and this included a bunch of bug fixes that I had written. Granted, 20% of those lines were comments, but I still lost an entire application that I was working on. Late night bug-bashing, bleary eyed and ready for sleep; I accidentally deleted my source file. Damn! Less than impressed with myself, I unmounted my partition and tried to recover the file using debugfs. No dice. I was bummed and almost sad..... almost.
A few weeks ago, I decided that it would be a good idea to set up some sort of version control system for my coding projects. My requirements were fairly simple since there was only going to be one person submitting code for the various projects, although there may be more than one computer submitting code changes.
What I needed:
1. A simple server setup accessible from both my laptop and my desktop.
2. A simple server setup accessible from both my laptop and my desktop.
Yes, I know, one and two are the same, but I thought that the requirement was important enough to warrant mentioning twice.
I looked at Git
, and Bazaar
as possible candidates for my version control system. For some reason, it was bazaar that caught my attention and this was probably due to the quick reference guides and tutorials on the bazaar homepage.
Unfortunately, their was not a tutorial on setting up a remote server other than an sftp server, so I sort of pieced together the bits I needed to set up bazaar host using ssh. Perhaps the full bazaar documentation has an explaination. To set up my bazaar server to handle ssh connections, I did the following.
1. make an ssh account on the remote machine
2. install bazaar on the remote machine
3. determine where on the machine to store my code and make sure that my ssh account has read/write permissions to the folder
Now I can write code on my laptop and use bzr to push the code to the SSH server. Later, If I want to test the code on my desktop, I can use bzr to get a copy of the code from the SSH server.
So I lost a bunch of code, but I had a very recent backup of the code on my little SSH server machine. Not bad, not bad at all.
In hindsight, and after reading a bit more of the documentation on the bazaar website, I probably should have set up my system to use a centralized repository
to handle my code changes. Similarly, there was an easier way for me to get a more recent backup of my deleted file.... but that is for another time.