It’s so interesting to know that you usually use the version control in your work. Perhaps there are some files named with numbers like these in your computer:
Why these file exist and have such names? You add a number or a date string to the end of the file name because you want to have a backup of your current work. If you go wrong in the future and want to have the latest good version, you can get it easily (may be not quickly). As you can see, version control plays an important roll in your work though you are not aware of it.
A good version control system (VCS) will allow you to do the following stuff easily:
- Backup and restore: files are saved when you need. You can jump to a previous version any time. You can throw many recent change and roll back to the last good version in the database. You can all so get the code from last year and what have changed when getting a bug.
- Synchronization: all people can have a up-to-date version easily.
- Track changes and ownership: the VCS can store the information about changes in you files and who the person who made it, which make you easily to see how a file is evolving over time.
- Sandboxing: as its name, you can freely make and changes in you code and test it in your own computer before “checking in” what you have done.
- Branching and merging: you can made your own copy of the code, save it in a separate location and develop it in isolation. Later, you can merge your work back into the common area.
There are many implementation of a VCS, but all of them should involve these concepts:
- Repository: the database storing files
- Server: the computer has the repository
- Client: the computer connect to the server to use the repository. The server and the client may be the same computer.
- Trunk/Main: the primary location for your code. It is considered as the main branch of your work.
- Add: put a file (and/or a directory) into the repository in the first time.
- Revision: the version of a file. It can be a number-liked string as 1, 2, 3, … or 1.2, 1.3, …
- Head: the latest revision in the repository.
- Checkout: download files from the repo to your local computer. Some VCS allow you edit the files when they were checked out, others require a explicit option when checking out, otherwise they only give you a read only version.
- Check in: upload files to the repository. If the file exists and have changes, it will have a greater revision number. You can leave a message when checking in.
- Changelog/History: a list of changes to a file from the time it’s added to the repository.
- Update/Sync: ynchronize you files to the latest version (head version) of the repository.
- Revert: throw away your local changes and roll back to the latest verion from the repo.
- Branch: create a separate copy of your work. It is also a noun refers to the working copy which is branched.
- Diff/Change/Delta: find the differences between two files.
- Merge/Patch: apply changes from a file to another, for example, aplly what you did in you branch to the common work.
- Conflict: when there are some changes which cannot be applied in a files in the same time, you know that there is a conflict.
- Locking: make some files not allow other people to edit it. This is usually used to prevent conflict. You can unlock it later. Some person can unlock the files on purpose when needed, which is called breaking the lock.
Thanks to Kalid Azad at https://betterexplained.com for this section.
After reading all above, you can wonder how to use a VCS, implement your own? Feel free to try, but there are many free tool can help you. SVN (subversion https://subversion.tigris.org) and GIT (https://git-scm.com) are two of them. If you are working in Linux or some console system, just get these software to your computer and you the console! For windows users, TurtoiseSVN and TurtoiseGIT (found at https://tortoisesvn.tigris.org and https://code.google.com/p/tortoisegit/) can be a great choice.