Understand git clone command, difference between svn checkout and git clone

Understand git clone , svn checkout Vs git cloneRecently our project migrated from SVN to GIT Distributed Version Control and later I came to know that it has lot of advantages over SVN. So I started looking into GIT basic terminology like clone , commit , pull , push fetch , rebase , merge , branches and honestly speaking earlier I was very confused but as soon I started going into the depth I found it interesting and something that I have never worked till now. I read lot of books , lot of blogs on basic GIT terminologies and here I am going to write my findings on same, so that it can help newbies like me and most importantly for my future reference.

So whole story begins with how to get the code into your local system so that you can start working , In GIT this magic is done by one simple command that is git clone command
git clone :  With the assumption that you have some central repository configured on some server and now you want to bring all that code into your local system for the first time. So , here comes the git clone command into picture , it will copy all the files from the central repository to your local system , if you have worked on svn earlier then you might think that it is same as svn checkout but honestly speaking git clone is very different from svn checkout , the main difference is ,the repository that is copied on your local system is also a full fledged repository ,,meaning it will have its own commit history , revision history etc. git clone command

Don’t worry it will also be linked to your central repository because it always remembers from where it is cloned but it won’t communicate with the central repository unless it has been told so to do that.
For cloning you need to execute git clone command like this :

$ git clone <repolocation> <location_on_your_local_machine>

Here , repolocation represents the locations where your central repository is located and location_on_your_local_machine represents the location where you want to copy the whole code in your local system.

git clone command






e.g this git clone command will bring Git Ruby library into your local system using GIT Protocol into the current directory

$ git clone git://github.com/schacon/grit.git

git clone is like a one time operation and after that you will perform all the other operations on your local repository. The other difference that we need to understand between GIT and SVN is GIT don’t differentiate between local and central repositories , all of them are full-fledged git repositories or in simpler terms you can say that it is a repository to repository interaction.

In the last git clone can use different types of data transfer protocols to move the data from git central repository to local system e.g git protocol , http(s):// protocol or SSH transfer protocol , it all depends on your central repository which all it supports. Below are the examples for each type of protocol.

$ git clone https://tech-idiot@github.com/firstrepo/firstexample.git

$ git clone ssh://tech-idiot@techidiocy.com/firstrepo/firstexample.git

Please share your thoughts and comments on the same ,and feel free to correct I have mentioned anything wrong above.
Thanks for dropping by.
Note : All images belong to their respective owners , i have just used them for reference.


Saurabh Jain

A Developer working on Enterprise applications ,Distributed Systems, Hadoop and BigData.This blog is about my experience working mostly on Java technologies ,NoSQL ,git , maven and Hadoop ecosystem.

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

One thought on “Understand git clone command, difference between svn checkout and git clone

Add Comment Register

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>