Topics Discussed:
- What is and Why Version Control?
- Types of Version Control
- Version Control in GitHub
All software is written in code. We need to save that code. Once it’s done, we need to change or make changes to code. So we will save it as test1/new1 i.e with new names. If there is only one file it’s manageable. If there are more files, it’s hard to manage. And this same case comes when there are more people contributing to one file.
We implement version control as the solution for these problems. It has a database and it tracks all the changes.Version control is available for documentation, pictures etc. History tracking is a type of version control.
Why do we use Version Control ?
● Mainly for long term history
● Traceability
● Branching and merging
● Addition of any number of people/contributors
Different types of version control
● Initially, the particular file can be editable by the creator only. It’s the first generation.
● Next generation version control software is client level.
Multiple people can make changes.
If the server is down, no change can be done.
We take files from the server to make the changes and we finally merge it.
● Third generation version control
It’s distributed and fast.
e.g : Git, Mercury
● Distributed version control
Repository – it’s a database. It contains different versions of the file. We set up this repository locally. That is called cloning.
1. Clone – To get files from repo to the local system. Then we get a working copy. Here we can add, edit, delete.
2. Commit – git commit We will make the changes to the local repository. Each commit have a unique id
3. Checkout – To pull
4. dif – to know the difference in local and system repository
5. Branch – it has the same set of files. Useful when one person is testing and another person is checking bugs. Once it’s done they can merge it.
Git – by Linux Community
GitHub, Gitlab, DevOps Repo
git init– to create a local repo.
git clone – git clone
to clone the remote repo to our system remote repo will be origin in GitHub
git add – to add or connect it with repo git add .
git commit – to add all the files to local repo
git push – to make the changes to remote repo
git pull – to makes changes to local repo
git checkout – to switch between branches.
git branch – to create new branch
merge – we can merge to a particular branch. We will get a combination of both branches. Merging is Git’s way of putting a forked history back together again. The git merge command lets you take the independent lines of development created by git branch and integrate them into a single branch
rebase – to rewrite. Rebasing is the process of moving or combining a sequence of commits to a new base commit.