Recently 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.
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.
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://email@example.com/firstrepo/firstexample.git $ git clone ssh://firstname.lastname@example.org/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.
Latest posts by Saurabh Jain (see all)
- java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.TaskInputOutputContext, but class was expected - August 8, 2014
- org.datanucleus.store.rdbms.exceptions.MappedDatastoreException: INSERT INTO “TABLE_PARAMS” – Hive with Kite Morphlines - July 17, 2014
- java.io.IOException: can not read class parquet.format.PageHeader: null – Hive - July 12, 2014