Version Control Flashcards
What are the benefits of version control?
Collaboration -> organised and smooth task collaboration among team members
Storing versions -> stores file versions after making changes
Restoring previous versions -> ability to revert to previous versions if needed
Understanding what happened -> changes accompanied by comments explain reason for change
What are the 3 types of version control?
Local VC
Centralised VC
Distributed VC
What is local VC?
On local PC
Not good for collaboration
Error prone
What is centralised VC?
Trad. method to enable collaboration among devs on same project
Single server contains all versioned files and clients can check file from that place
Risk -> if server fails the data can be lost
What is distributed VC?
Modern VC systems where everyone gets a copy of the files on their local machine
Allows many backup copies to exist
What is Git?
Free, open-source distributed version control system
What are the main functions in Git?
Commit -> snapshot of changes
Branch -> separate version of project files, each branch has a name and a chronological chain of commits
New branch -> when created, files in the main branch are replicated. changes that are not in the main branch should be made here
What are the git commands?
git init - creates an empty git repo
git add - adds file contents to staging area
git commit - records changes to repo
git checkout - switch between files, commits or branches
git push - update remote repo with committed files
git fetch - download files from another repo
git merge - join two or more development histories together
git pull - fetch from and integrate with another repo or local branch
git branch - create, list, rename or delete a branch
git status - shows current status of branching and HEAD position
What is Github?
Remote host for git repositories
Facilitates:
- version control
- collaboration
- issue tracking
What is a protected main branch?
Projects often have a protected main branch that is
- clean error-free version of code
- in remote/shared rpo
- cannot push directly
- must request to add changes to main branch
What is a PR?
Pull request - request made when you want to add changes to the main branch
Allows quality control of code that is in the main branch