Revision Control
One primary area of CM for software engineering is the use of version control management systems. This is the area that specifically manages computer files, which can include documents, source code, and much more.
There are two main approaches to version control management systems. That is, they can either be centralized, or decentralized. This lecture covers Subversion and Git, which are two different ways of storing file histories.
Suggested Reading:
- Read Chapters 1-3 of the subversion book: http://svnbook.red-bean.com/
- Read Chapters 1-2 of the git book: https://git-scm.com/book/en/v2
Benefits
A version control system (or revision control system) is a system that tracks incremental versions (revisions) of files and, in some cases, directories over time.
A VCS is useful because it allows you to explore the changes which results in each of those version and facilitates the arbitrary recall of the same.
A repository is the central store of a system's data and is at the core of the version control system. Repositories store information in the form of a filesystem tree, a hierarchy of files and directories.
Any number of clients can connect to the repository and read/write to these files.
As the files in the repository are changed, the repository remembers each version of those files.
A version control client has the ability to request previous states of the filesystem from the repository.
Centralized vs. Decentralized Version Control Systems
There are pros and cons to each system. Subversion is the older type of version control system that is centralized. Git is a newer version that is decentralized.
Feature | Centralized (Subversion) | Decentralized (Git) |
---|---|---|
Concurrent Access Control | File Locking | Manual intervention required to resolve conflict |
Offline Development | Unable to submit changeset; create tag/branch | Able to commit to local repository |
Remote Server | One centralized server | Multiple remote repos |
History | On the server; "Set in stone" | Local to every user; Modifiable |
SVN & GIT Commands
Here’s some of the commands that you can type into the CLI for each VCS.
See Appendix D. for a quick guide to using git with the command line
Operation | Git Command | SVN command |
---|---|---|
Initial checkout from | git clone <url> | svn checkout <url> |
existing repo | git checkout <origin/branch> | |
Update locally from repo | git fetch git pull (fetch and merge) | svn update |
Diff locally changed file | git diff <filename> | svn diff <filename> |
Revert locally changed file | git checkout <filename> | `svn revert |
Revert all local changes | git reset --hard HEAD | svn revert . R |
Commit changes to repo "message" | git commit -m "message" git push | svn -ci m <filename> |