Intro
version control
Version control is also known as revision control /source control is a class of systems responsible for managing changes to your files.
Types of version control system
- Centralize version control systems
- Distributed version control systems
Centralized version control system
CVCS have only one central repository. Repository is basically a server which all the file and history are stored. The machine can access the repository via LAN and WAN.
Example of CVCS:
Concurrent version system (CVS)
Subversion (SVN)
Distributed version control system
DVCS don't require a central server that contain repository. Every user has its own repository called local repository.
Example of DVCS:
- GIT
- Bit-keeper
What is git ?
GIT is a decentralized version control system used to keep changes of your file.
GIT was developed by Linus Torvalds in 2005 for efficient code management and version control of their project. Understanding basic commands of git could help you in storing your projects in your local repository and pushing them into your remote repository.
Git installation
.Windows
.Mac
.Linux (Debian)
$sudo apt-get install git
Git commands
The following are basics commands of git.
git config
This command is used to set user configuration such as user-name and user-email as shown below:
git init
This is one of the common git command you will be using. Its used to initialize local git repository.
git add
The command git add is used to add the file into local repository for example below the .index will be added to local repository:
git status
This git status command is used to check status of working tree. Below you see three file which are untracked:
git commit
The git commit command is used to commit in the staging area. The committed changes will now go to remote repository. Example:
git push
Once the files have been committed the git push command is used to push the files to remote repositories:
git pull
The command git pull is used to fetch/merge content in remote repository into local repository:
git pull
git clone
This command is used to download existing git repository into your local repository. For example below the git clone command will download the files from existing remote repository to local repository(basics of git):
git rm
The command git rm will delete or remove the file from repository: Below we can see the file .index removed:
git branch
This command is used to create a new branch. Example git branch will create new branch called myapp:
git checkout
This command help you to navigate from one branch to another. Example we used git checkout to navigate from master branch to myapp branch:
git merge
The git merge is used to integrate two branches together. It will merge one branch to another active branch. Below we have merge myapp to master branch:
Top comments (0)