Git is a version control system.Other common version control systems are SVN,TFS.Version control systems are used to manage the different versions of files.
GIT is Distributed or centralised version control system
GIT is a distributed version control system.This means that there is no central server which stores the repository.But each user working with a repository has a copy of the repository of his local machine,called working directory.
This is big advantage over centralised version control systems because of following reasons:
Since the files are not stored on a single central server so if the files on the centralised server are corrupted the files from the local repositories can be restored.
Another advantage is users can work offline with connecting to the remote repository.
Repository contains all the directory files that are managed by GIT.Repository is just like any other folder.Only difference is that a Repository contains a .git directory which stores the metadata about the repository.
There are two types of repository
- Local On the users local machine
- Remote On the remote machine
How to create a repository
There are two ways to create a repository in GIT
- Clone an existing repository
- Create a new repository
To clone an existing Repository use the following command
git clone “remote repository” “local path where repository is to be cloned”
To create a new repository
Staging means adding new or modified files to staging area.Multiple files can be staged at a time.
A stage file can be unstaged also.We can check the status of the staged files using the git status command.
Committing means the changes in the modified or staged files are made permanent.
Different users can work on different features using different branches.There is one master branch and multiple feature branches.One branch be merged into another branch.