how does version control work?

99封情书 提交于 2019-12-19 05:23:57

问题


how does version control usually work? does it save diff files as a trail with hashes to validate the trail?


回答1:


Different VCS use different approaches. CVS, for example, will create a file on the server for each file which you commit. This is essentially a file in RCS format; CVS is only a wrapper around RCS which runs the RCS commands over many files in a directory subtree (RCS can only work on single files).

The RCS file contains a list of changes (version number, checkin message and how much was changed). After that comes a copy of the current HEAD version. The rest of the files are the diffs between the versions (long explanation).

This way, CVS can quickly return the HEAD version (which is most often requested) and it can compute the other versions.

CVS doesn't do any validation; if one of your files becomes corrupt, you need a backup. Since CVS is based on RCS, it can't version directories nor can it track renames. CVS and RCS use the standard diff(1) command to create the diffs.

Subversion (SVN) works similarily but adds versioning of directories and renames. Moreover, SVN uses a better diff algorithm (xdelta) which gives a smaller repository.

For an explanation how Git works, see here.




回答2:


Check out Eric Sinks blog series on version control.

Also, Joel Spolsky wrote Hg Init: a Mercurial tutorial, that finally made me "get" what distributed source control is all about.

There are more than one ways to skin a cat...




回答3:


Darcs is very different and IMHO more intuitive than other SCMs even distributed ones. There's an excellent guide for beginners about how it works: Understanding Darcs.



来源:https://stackoverflow.com/questions/876506/how-does-version-control-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!