Vainolo's Blog

Push, Baby, Push! (to Github)

leave a comment

I did it! I did it! I managed to destroy one of my Git repositories. Don’t ask me how. I was working just like every day (or night) and my computer suddenly crashed (turned itself off, just like that). Oh well, I said to myself, hope not too many files were destroyed… and that the computer will turn on again.

It did turn on, but when I started working I one of my repositories had this strange branch name: (ref: re...). After poking around a bit, it came to me that something was wrong. I couldn’t switch to my master branch, neither to my other branches, my HEAD was gone. Oh sucks :-(. So I asked in good ‘ol SO what to do and after a number or analysis and iterations the final diagnosis came: my repo is broken, with no way to recover it. This sucks. Thankfully there were not many changes in it so I was able to extract them and apply them to a new clone of the repository (thanks once again to github for their service!).

So if you are working with git, and you have a computer that tends to die suddenly (but also if you don’t), push frequently. Even if the code doesn’t compile but you have done many changes, push them. Create a branch for this, or another remote, or whatever if you have a special policy that only “fully working code” is pushed. But please, push your code. You will never regret it.

Enhanced by Zemanta

Written by vainolo

March 11th, 2013 at 6:30 pm

Posted in Programming

Tagged with , ,

Leave a Reply

%d bloggers like this: