You seem to be looking for a versioning system, much like
cvs.
I personally use cvs to keep track of my code, but will probably switch to
subversion as soon it is a bit more stable. If you are using
debian, cvs is a simple
apt-get install cvs away. {There are even windows and macintosh clients for cvs, which also support ssl.}
Other non open source programs that provide versioning include BitKeeper, sourcesafe, etc.