Version control on a 2GB USB drive

Jason Baker picture Jason Baker · Sep 19, 2008 · Viewed 13.4k times · Source

For my school work, I do a lot of switching computers (from labs to my laptop to the library). I'd kind of like to put this code under some kind of version control. Of course the problem is that I can't always install additional software on the computers I use. Is there any kind of version control system that I can keep on a thumb drive? I have a 2GB drive to put this on, but I can get a bigger one if necessary.

The projects I'm doing aren't especially big FYI.

EDIT: This needs to work under windows.

EDIT II: Bazaar ended up being what I chose. It's even better if you go with TortoiseBzr.

Answer

Milan Babuškov picture Milan Babuškov · Sep 19, 2008

I do this with Git. Simply, create a Git repository of your directory:

git-init
git add .
git commit -m "Done"

Insert the stick, cd to directory on it (I have a big ext2 file I mount with -o loop), and do:

git-clone --bare /path/to/my/dir

Then, I take the stick to other computer (home, etc.). I can work directly on stick, or clone once again. Go to some dir on the hard disk and:

git-clone /path/to/stick/repos

When I'm done with changes, I do 'git push' back to stick, and when I'm back at work, I 'git push' once again to move the changes from stick to work computer. Once you set this up, you can use 'git pull' to fetch the changes only (you don't need to clone anymore, just the first time) and 'git push' to push the changes the other way.

The beauty of this is that you can see all the changes with 'git log' and even keep some unrelated work in sync when it changes at both places in the meantime.

If you don't like the command line, you can use graphical tools like gitk and git-gui.