Up to Main Index Up to Journal for January, 2014 JOURNAL FOR THURSDAY 30TH JANUARY, 2014 ______________________________________________________________________________ SUBJECT: I really, really do not believe what I did... DATE: Thu 30 Jan 22:50:13 GMT 2014 The background: When coding I keep all of my work in Git. I also do a lot of rebasing and stashing. In fact I have two aliases configured 'g ss' and 'g sp' - stash save and stash pop. Quite often when you stash you do so because you want your current working copy to be pristine. So a short while ago I modified the 'ss' alias to be: stash save -u The addition of the -u means stash untracked files as well as modified files. Everything was good. Yesterday WolfMUD Wednesday happened and I finished off the work refactoring recordjar and the decoder. In fact everything went really well. I saved a stash and then applied it back again - that way I'd have a stashed copy if things don't work out well - and started rebasing changes and committing them. Once everything was committed I check everything still compiled and ran - which it did. While checking the commit logs I noticed there were quite a few old stashes hanging around. Everything was committed so I dropped the stashes and as I had done a lot of rebasing I did a 'git gc' to do garbage collection and clean things up. With that done I decided to finish for the night while I was ahead... This evening I thought I would write the few encoder bits that account creation needed. Commit the changes, push it to the public dev branch and then shout about it. I know everyone has been waiting long enough! So I wrote the bits of the encoder account creation needed. Then went to hook it into the account driver and... where was it!? The account driver was missing :( Suddenly I realised what I had done *face palm*. The evening before I had just dropped the stashes. The account driver was a new file in progress and had not been checked in yet and was untracked. When I dropped the stashes I threw it away. To make matters even worse I'd done a garbage clean up and thrown away all of the dangling objects... Argh! :( I thought I might be able to recover the account driver from one of my Windows test machines or the Raspberry Pi - nope, no dice. Since I had been experimenting with cross-compiling I hadn't needed to copy the sources over for testing... Aarrgghh! I hunted everywhere on about seven machines. In the end I found an old Vim swap file from weeks ago that had about half of the account driver code in it :( So now I have to rework the account driver code I have, refactor it to fit with recent changes and then finish it again. How could I have avoided this? Backups would be nice. Well I have backups that run overnight - but it's only a single backup copy. By the time I'd realised what I had done the data from the previous backup was overwritten. Currently I don't have the money to implement proper rotating backups for terabytes of data. I also have the habit of not committing stuff to Git until it works and is ready. This was why the account driver was not committed. Perhaps I need to work on a 'work in progress' topic branch which I commit to more often even if things get broken and won't compile. Then when I am ready I can rebase and clean up everything before committing to the normal dev branch. At least a topic branch can be pulled and push around different machines easily - at least until I can afford to do proper backups. -- Diddymus Up to Main Index Up to Journal for January, 2014