20120930

Version Control: Started using git and github (and how to set-up a remote git server)

The Octocat, Github's logo
It's been almost 6 years since I used some kind of revision control system. Back then I wasn't sure about which I wanted to use... I settled with RCS, the father of them all. RCS was structurally very simple, with text-based (human-readable) delta files. I liked that. I had all my code and TeX files under revision control, but then I started using more than one computer and it got out of hand very quickly (using RCS or CVS in Windows was quite tricky and had user and encoding problems.) Stopped using it. After a few years I tried darcs... unconviced. Then I put some of my code in the cloud, in Google Code, so I got to use a little SVN. Not for version control, just for having my code online and tidy. Nothing else.

It was about time that I got again into source code control. For part of my work I will use mercurial, so for my side projects I will be using git, to see what else is trendy right now. Yeah, it has taken me ages to do it :D

I put my thesis under control and committed a few revised sections. So far it works wonders with the built-in emacs vc-mode (version control mode.) I even get a neat menu to check in/out or check the commit story. I have not checked yet its interaction with github with push or pull, but I guess it will work as well. If it doesn't, my emacs loving twitter pals Rami and Anti have suggested the magit package. I'm not sure about it, because it is recommended when git is your only version control system, and I also want to use mercurial. Only time will tell, though.

By the way, the first real commit I did was for my work in progress with getting some acme magic into emacs. You can check it here in github (which works very well so far... why did it take me so long?).

I also set a private repository in my own server to host my emacs org files and calendar. I followed the following steps at first...
mkdir targetrepo
cd !$
git init
cd ..
git clone --bare targetrepo targetrepo.git
mv targetrepo targetrepo.backup
git clone targetrepo.git
A somewhat convoluted way to (I think) just doing this, but I'm not sure:
mkdir targetrepo.git
git init --bare
Now you have to connect to it in the local machine (and transfer the local files,) in the desired directory
git remote add origin username@server/path-to/targetrepo.git
git push origin master
And you're set to go. I got it configured in my server, Macbook and... iPod Touch. Now I have my emacs org-based calendar wherever I go, with (manual) syncing among machines. Reinventing the wheel FTW!
Written by Ruben Berenguel