What is version control system
It’s a system that allows to manage changes made to a software project over time
* Tracking changes
- revision history
- list of (snapshots +
timestamps)
- diff between snapshots
* Reverting to previous versions (snapshots) of the code
* Easing collaboration
- keeps track and helps
unify conflicting versions
of the same file
What are the two types of vcs
1.Centralized VCS
2.Distributes VCS
Explain what a centralized VCS is
➢ central server with single main repository
➢ revision history on the central server only
➢ need to be connected to the server for
most operations
➢ multiple co-existing versions of the same
artefacts if modified by different persons
➢ e.g., SVN
Explain what a distributed VCS is
➢ central server + local copy of the
repository with revision history
➢ every dev has full control of their local
repository
➢ most operations do not need connection
to the server
➢ merge modifications with the new
modifications of the central repository
➢ e.g., Gi
What is Git
It’s a distributed VCS with the key features like tracking changes and collaboration
Explain Working Directory vs Staging Area vs Local Git Repository vs Remote Git Repository
Working directory is where you have all the files open on your personal laptop and staging area is where you code goes when you call git add, local repository is where your code goes after git commit and finally your code goes to remote git repository when you call git push
How do you clone an existing repository
git clone <url></url>
How to turn a local directory into a git repository
git init
How to stage untracked files
git add file.text
How to check what files are untracked in the working tree
git status
How to create a new snapshot
git commit –m “message”
How to list the commits in reverse chronological order
git log
How to get the abbreviated stats for each commit
git log –stat
How to unstage files from staged to modified
git reset HEAD file.txt
How to discard changes in the working tree to revert the file before modification
or replace it with the one of last snapshot
git checkout file.txt or edit manually
How to update the changed files/git message of the last commit
git commit –amend
> git commit –m “added files lectures 1 to 5”
> git add lecture-6.pdf
> git commit –amend –m “added files lectures 1 to 6
How to undo changes of a commit and does not delete the commit
and replays it in reverse
and create a new commit for reverting the change
git revert <commit></commit>
What are remote repositories
They are versions of your project hosted somewhere else
what command do you use to show the remotes of your repository
git remote –v
What command do you use to download data from the remote repo to your local repo
git fetch
what does git pull do?
it fetches + merges data with your working tree
- pull = fetch + merge
what command do you use to send your commits to the remote repository
git push
What does merge do
If files are modified after your last commit > git pull
➢ If there is at least a commit you don’t have on your local repo
➢ your push is rejected
➢ to continue, you have to merge
You must first pull the commits you don’t have to your local repository
* If no conflict, the merge is automatic
* If conflicts exist, you must solve them manually
What is data persistence?
Data created in the context of a running process must persist/be recovered after the process has ended therefore must be stored in a long-lasting storage medium.