Git is a distributed version control system which places emphasis on speed and efficiency. Git was developed by Linux kernel developers in 2005.
In 2002, the Linux kernel community worked with BitKeeper, a distributed version control system (DVCS) that predated GIT. In 2005, however, the relationship between the Linux kernel community and BitKeeper began to suffer. As a result of this roadblock, the community began development on their own DVCS, Git.
Git is free & open source, small & fast, and distributed. It supports such branching & merging, data assurance, staging area, large project handling, high speed, support for non linear development, simple design, etc.
Supported Operating Systems:
Git is mainly developed on Linux operating system, but right now it is also supported on MAC OS X, Windows, CentOS, POSIX, BSD and Solaris.
The following companies and projects using Git:
Rails, Facebook, Google, Twitter, Android, Microsoft, Netflix, Linkedin, PostgreSQL, Linux, Gnome, eclipse, perl, Qt, KDE, xserver.
Installing on Linux (Ubuntu):
$ sudo apt-get install git-all
Installing from source:
$ sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
There are many ways to use Git for your projects. Originally, Git was used on command line tools. There are lots of GUIs tools available on the market. If you know how to run Git commands on the command line, you will likely be better off, and while it is very easy to use GUI tools, the opposite is not always true.
Git can used as a server. Git server softwares (e.g. Github) helps out of the box like add access control, display contents of Git repository via the web and help to maintain multiple Git repositories.
There are two main approaches to starting a Git project:
1. Takes an existing project (repository) and imports it into Git.
2. Clones an existing Git repository (project) from another server.
Initializing a project (repository) in an existing directory –
$ git init
This will create a new directory (at project root directory) named .git that contains all useful repository files and folders. Nothing is tracked yet.
If you want to start version controlling, you need to set up file tracking and an initial commit. You can do this with the following commands:
$ git add . # adds all files on staging area
$ git commit -m “initial commit” # stage the changes on repository
Cloning an existing project (repository) –
If you want to clone an existing Git repository, you can use git clone command.
git clone [url] where url is the url that you wish to clone.
$ git clone https://github.com/example/example
It will create ‘example’ directory, initialize .git directory, pulls down all the files & folders of that repository and check a working copy of the latest version. If you want to clone the above repository into a directory named ‘sampleapp’, instead of ‘example’ directory, you have to mention it with the command line option:
$ git clone https://github.com/example/example sampleapp
This command will act same as above but target directory is different, called ‘sampleapp’.
Git has a number of transfer protocols like
https://, git:// and SSH transfer protocol.
Github is a hosting service which manages Git repositories. Github combines the distributed version control and source code management (SCM) functionality of Git with some extra features. Git is available only as a command line tool, while Github is available both as a GUI tool and as desktop packages or mobile apps. Github offers both private and public repositories.
Github has the following features:
- Issue tracking
- Tasks management
- Commits history
After cloning, you can see remote server by:
$ git remote -v
If you need to distribute your project (repository), you need to push that project to github. If we need to push master branch to your git repository on github (origin server), use the following command:
$ git push origin master
Git is highly used in the market as a distributed version control system. Many well known companies are using Git for managing their big projects for version controlling. One main reason that Git is popular is because of Github.