A version control system serves the following purposes, among others.
Version control enables multiple people to simultaneously work on a single project. Each person edits his or her own copy of the files and chooses when to share those changes with the rest of the team. Thus, temporary or partial edits by one person do not interfere with another person’s work.
Version control integrates work done simultaneously by different team members. In most cases, edits to different files or even the same file can be combined without losing any work.
Version control gives access to historical versions of your project. This is insurance against computer crashes or data loss. If you make a mistake, you can roll back to a previous version.. You can also undo specific edits without losing all the work that was done in the meanwhile. For any part of a file, you can determine when, why, and by whom it was ever edited.
Repositories and working copies
Version control uses a repository (a database of changes) and a working copy where you do your work.
Repository keeps linear and branching history
Centralized and distributed version control
A conflict occurs when two different users make simultaneous, different changes to the same line of a file. In this case, the version control system cannot automatically decide which of the two edits to use. Manual intervention is required to resolve the conflict.
“Simultaneous” is not exact same moment of time. Change 1 and Change 2 are considered simultaneous if: 1. User A makes Change 1 before User A does an update that brings Change 2 into User A’s working copy, and 2. User B makes Change 2 before User B does an update that brings Change 1 into User B’s working copy.
It is better to avoid a conflict than to resolve it later. There are some best practices to avoid conflicts,
Version control best practices
Use a descriptive commit message
Make each commit a logical unit
Avoid indiscriminate or half-done commits
Incorporate others’ changes frequently
Share your changes frequently
Coordinate with your co-workers
Remember that the tools are line-based
Always inspect your changes committing
Versioning your database/reports isn’t optional.
Be careful that nobody else cares about your personal user settings