Sunday, March 23, 2014

Introduction to Git for beginners (What is git?) (Git tutorial)

Introduction to Git

Git is a free distributed version control system. What distributed means here is that every single developer contains a source repository on their individual machine.

The diagram below shows the difference between a centralized version control system TFS (Team Foundation Server)  and git. Notice that in git, every developer installs git on his machine and has the complete repository locally.

Git was written in Perl and C. Git can be installed on Mac, Linux, Windows and Solaris.

The main advantages of git are
  • You have your repository, so you can work completely disconnected from the main repository until you are ready to check in. (Until then you check in to you local repository)
  • Works across multiple operating systems. This is a big plus for bigger companies who have development on multiple platforms.
  • Handles large projects fairly easily
  • Strong branching and merging support
However Git also has these drawbacks
  • Steep learning curve
  • No inbuilt GUI support
  • Since you get the entire history of the files into your repository, initial fetch might take longer.
  • No locking support

Git itself does not have a GUI and only supports interaction through the command line console. However there are many free/paid third party GUI clients for git.

 For small personal projects and for learning, you can use github as your central repository. If you are setting up git for your organization, and don't want to put your code on a server that you don't control, then you could set up your own git server instead of using github. Typically this is what large organizations do.

Installing Git

For Mac, use the homebrew command
brew install git                   

Download git from here. When installing, except for the one screen shown below, use all the default options. Selecting the option as shown in the screen shot will make the git.exe command available from any path in the command prompt console window.

After the installation is over append ;<Git Installation location>\bin (for me that is ;C:\Program Files (x86)\Git\bin ) to the environment variable "Path". This is to make the ssh.exe command available from any path in the command prompt console window.

To get to environment variable click Start. Then right click Computer>properties. In the new window that opens up, click "Advanced System Settings". In the window that opens up, click "Environment variables" button.

Now you are ready to start using git. Enjoy!

Further reading:

Useful Git Commands

No comments:

Post a Comment

Comments will appear once they have been approved by the moderator