Version Control Systems (VCS)
- Tools that can register any change in any file or set of files over time
- They let us:
- Recover any older version
- Compare files over time
- Determine who changed the file
- ...
Local VCS
- Create backup of a project and store changes locally
- Advantage: simplicity
- Drawback: manual management (error prone)
Centralized VCS (CVCS)
- Create backup of a project and store changes in a remote server
- Many clients can connect to server and share their work
- Advantage: improves team work
- Drawback: if server fails, everything is lost
Distributed VCS (DVCS)
- Create backup of a project and store changes in a remote server
- Many clients connect to server and download the whole project
- Advantages:
- Improves team work
- If server fails, any client has a copy to restore
Git
- DVCS created by Linux team to solve their own version control problems
- Features:
- Speed
- Easy design
- Allows branches (non-lineal development)
- Suitable for big projects
Git data modeling
- Git stores snapshots of the project's filesystem
- With every change, Git only stores the new files changed, not the whole project
- For the rest of files, it just "points" to previous version
Other Git fundamentals
- Local work: many tasks are performed locally, which is faster, and lets us work with the project even without Internet connection
- Integrity: Git uses a SHA-1 algorithm to store information (data is always verified)
- Information addition: Git never removes anything, it only adds information. We can undo everything
Git project states
Every file in a project is in one of these three states:
- Modified: data has been changed locally, but it has not been committed yet.
- Staged: data has been tagged to be sent in next commit.
- Committed: data is safely stored in a local storage
Git sections
There are 3 sections in Git project:
- Git directory: metadata and database of the elements of the project.
- Working directory: files extracted from the Git database, ready to be used.
- Staging area: contains information about the files that will be sent in next commit.