2. Introduction to Version Control
● It is a component of Software Configuration Management
● It is also known as Revision Control or Source Control
● It is the management of changes to documents, programs,
and other information stored as computer files
● It keeps track of every modification over time in a special
kind of database
3. Before Version Control
● File Renaming
○ Rename “Code.java” to “Code01.java” or
“CodeDec25.java”
● Directory Renaming
○ Rename “src” folder to “src-2016Dec20”
● Zip File
○ Compress “MyProject” directory into
“MyProject-2016Dec15.zip”
4. Why Version Control
● Backup and Restore
● Collaboration
● Short-term undo
● Long-term undo
● Track Changes
● Track Ownership
● Branching and merging
5. Software Versioning Types
1. Centralized version control system (CVCS)
○ Central server is dedicated host, like “master copy”
○ Stores files history and controls access to files.
○ This is kept separately from your working copy.
○ Eg. SVN
2. Distributed version control system (DVCS).
○ Every clone of repository is independent and act as full fledged system
○ Stows the entire history of project files into a special hidden folder inside the
working copy on your hard drive.
○ Every commit gets added to the history in that hidden folder.
○ Eg. GIT, Mercurial, Bazaar
6. Why Distributed Version Control
● Cheap local branches for easy
experimentation
● History aware merges
● Full local history
● Offline commits
● To and fro revert back instantly
● Each working copy is a complete
backup of the repository
7. Version Control Concepts
● Repository - The database storing the files.
● Server - The computer storing the repo.
● Client - The computer connecting to the repo.
● Working set / Working copy - Your local directory of files, where you make
changes.
● Trunk / Main - The primary location for code in the repo.
● Branch - Create a separate copy of a file/folder for private use
● Commit - Command to store that version with some message input
● Checkout and revert - Jump to specific commit or branch or tags
8. Version Control Concepts contd...
● Merge - Apply the changes from one file to another, to bring it up-to-date.
● Conflict - When pending changes to a file contradict each other
● Resolve - Fixing the changes that contradict each other
● Tags - Static branch for storing a stable version
● Clone - Copy project to local from remote
● Push / Pull - send changes from local to remote or vice versa
● Logs - view the list of versions we have committed
● Diff - view changes within two points of commit or branches or tags
● Status - view local changes and files currently
9. Version Control Best Practices
● Use Good comments
● Commit often
● Single and multi project repos
● Branch / Tag when appropriate
● Respect the repository trunk (master)
11. Git Online Repo Services
● Github.com
○ Public repo for free
○ Charges for private repo
● Bitbucket.org
○ Best for private repo
○ Charges for more than 5 user contributions
● Gitlab.com
○ Have both private as well as public repo