Version control Flashcards
What is version control?
A system for managing changes to documents, programs, web pages
Why do we need version control?
Keep track of a revision history/versions of a document, enable users to collaborate on a collection of documents
Other version control systems other than Git?
rcs, cvs, subversion, mercurial
What are the 3 types of version control?
Local, centralized, distributed
They differ in how the version database is stored.
Local vs centralized?
For local, there is no server involved. The version database is stored locally. Only the local computer can checkout the file.
For centralized, there is a central server and each computer checks out the file from this server to get a local copy of the file on their own computer.
Centralized vs distributed?
For centralized, there is one server that saves the version database, no users have the database on their computer.
For distributed, there is a server with the version database and each user has their own version database on their computer.
Which VCS stores differences?
mercurial
Which VCS stores snapshots?
git
Differences vs snapshots?
Differences is when a file is changed, the VCS only saves the changes as a new version (the difference between the previous version to current). If one file among all files is not changed in a version, the file is not updated. For example, if file A is changed, version 1 is only the changes in file A.
Snapshots is when a file is changed, all files are saved as a new version the way they are. For example, if file A is changed, version 1 becomes file A1, B, C.
Why is using differences inefficient?
Because every time we want the latest version of a file, we need to start from the initial file and apply all the changes along the versions.
Describe the common git workflow.
git init/clone, git add, git commit, git push, git pull (git fetch + git merge)
Does git use a three-stage architecture?
Yes
Describe the three-stage architecture of Git.
The 3 stages are: working directory, staging area, local repository (.git repository)
Working directory is where the actual project files are located. Any changes made to files here are untracked. To get to staging area, we use “git add”.
Staging area is an intermediate step between the working directory and .git repo. We basically store everything we want to commit in the next commit here. To get to the .git repo, use “git commit”.
.git repo is like a container for Git’s VCS. It stores committed snapshots, the project’s history, and facilitate with Git operation. To move the files to the remote repo, use “git push”.
Commands to interact with the remote repo: git pull, git push, git clone, git fetch
Relationship between blobs, trees, and commits?
Each commit has a unique commit id and a tree id of the tree it belongs to. A tree stores its own id and blobs ids. A blob is just an object type used to store file contents and each of them has an id. Can think of each blob as a file in our repo.
Is a commit a snapshot of the state of the project?
Yes