GIT – Introduction
What is Version Control ?
Version Control is a system which records the changes made to a file so that you can recall a specific version later.
By using Version Control in your project, you can easily find out:
-
What are the changes made
-
Which files are changed
-
When were the changes made
-
Who has made the changes
Why Use a Version Control System?
A Version Control System (VCS) gives you many super-powers that help you track changes and secure your code such as:
-
Collaborating with big teams smoothly to develop code
-
Reverting the code to the bug-free version in case any minor change in the new version introduces a bug
-
Providing backup when the central server crashes
-
Rendering an option to time-travel your project and go to a specific version
Types of Version Control Systems
-
Local: It allows you to copy files into another directory and rename it (For example, project1.1). This method is error-prone and introduces redundancy.
-
Centralized: All version files are present in a single central server. For example, CVS, SVN, and Perforce.
-
Distributed: All changes are available in the server as well as in local machines. For example, Git and Mercurial.
Centralized vs. Distributed Version Control Systems
CENTRALIZED
You can keep changes only in the server
Changes can be merged in the server (remote) alone
Work gets interrupted if the server is down
DISTRIBUTED
You can keep changes locally (commit) as well
Changes can be merged locally as well as remotely
The project is present with all the team members to work locally
For Your Knowledge
-
git clone: Get the complete project from remote to your local machine
-
git pull origin <branch_name>: Get the new changes from remote branch to local branch
-
git push origin <branch_name>: Send your local branch changes to the remote branch
-
git remote add <name> <url>: Add a new remote repo link to your local repo
-
git remote -v: List all the remote repo URLs linked to your local repo
Cool Stuff Below !
21