Author:MayankJani,RubyonRailsDeveloper,
CodalInc.
Git
isadistributedversioncontrolsystemwhichplacesemphasisonspeedandefficiency.Git
wasdevelopedbyLinuxkerneldevelopersin2005.
In2002,theLinuxkernelcommunityworkedwithBitKeeper,adistributedversioncontrolsystem
(DVCS)thatpredatedGIT.In2005,however,therelationshipbetweentheLinuxkernel
communityandBitKeeperbegantosuffer.Asaresultofthisroadblock,thecommunitybegan
developmentontheirownDVCS,Git.
Features:
Gitisfree&opensource,small&fast,anddistributed.Itsupportssuchbranching&merging,
dataassurance,stagingarea,largeprojecthandling,highspeed,supportfornonlinear
development,simpledesign,etc.
SupportedOperatingSystems:
GitismainlydevelopedonLinuxoperatingsystem,butrightnowitisalsosupportedonMAC
OSX,Windows,CentOS,POSIX,BSDandSolaris.
ThefollowingcompaniesandprojectsusingGit:
Rails,Facebook,Google,Twitter,Android,Microsoft,Netflix,Linkedin,PostgreSQL,Linux,
Gnome,eclipse,perl,Qt,KDE,xserver.
InstallingonLinux(Ubuntu):
$sudoaptgetinstallgitall
CodalInc
UXDesign&AppsDevelopmentAgency
www.codal.com
Installingfromsource:
$sudoaptgetinstalllibcurl4gnutlsdevlibexpat1devgettextlibzdevlibssldev
CommandLine:
TherearemanywaystouseGitforyourprojects.Originally,Gitwasusedoncommandline
tools.TherearelotsofGUIstoolsavailableonthemarket.IfyouknowhowtorunGit
commandsonthecommandline,youwilllikelybebetteroff,andwhileitisveryeasytouseGUI
tools,theoppositeisnotalwaystrue.
GitRepository:
Gitcanusedasaserver.Gitserversoftwares(e.g.Github)helpsoutoftheboxlikeaddaccess
control,displaycontentsofGitrepositoryviathewebandhelptomaintainmultipleGit
repositories.
TherearetwomainapproachestostartingaGitproject:
1.Takesanexistingproject(repository)andimportsitintoGit.
2.ClonesanexistingGitrepository(project)fromanotherserver.
Initializingaproject(repository)inanexistingdirectory
$gitinit
Thiswillcreateanewdirectory(atprojectrootdirectory)named
.git
thatcontainsalluseful
repositoryfilesandfolders.Nothingistrackedyet.
Ifyouwanttostartversioncontrolling,youneedtosetupfiletrackingandaninitialcommit.You
candothiswiththefollowingcommands:
$gitadd.#addsallfilesonstagingarea
$gitcommitminitialcommit#stagethechangesonrepository
Cloninganexistingproject(repository)
IfyouwanttocloneanexistingGitrepository,youcanusegitclonecommand.
gitclone[url]whereurlistheurlthatyouwishtoclone.
CodalInc
UXDesign&AppsDevelopmentAgency
www.codal.com
$gitclonehttps://github.com/example/example
Itwillcreateexampledirectory,initialize.gitdirectory,pullsdownallthefiles&foldersofthat
repositoryandcheckaworkingcopyofthelatestversion.Ifyouwanttoclonetheabove
repositoryintoadirectorynamedsampleapp,insteadofexampledirectory,youhaveto
mentionitwiththecommandlineoption:
$gitclonehttps://github.com/example/examplesampleapp
Thiscommandwillactsameasabovebuttargetdirectoryisdifferent,calledsampleapp.
Githasanumberoftransferprotocolslikehttps://,git://andSSHtransferprotocol.
Github:
Github
isahostingservicewhichmanagesGitrepositories.
Githubcombinesthedistributedversioncontrolandsource
codemanagement(SCM)functionalityofGitwithsomeextra
features.Gitisavailableonlyasacommandlinetool,while
GithubisavailablebothasaGUItoolandasdesktop
packagesormobileapps.Githuboffersbothprivateand
publicrepositories.
Githubhasthefollowingfeatures:
Issuetracking
Tasksmanagement
Commitshistory
Wikis
Graphs
Aftercloning,youcanseeremoteserverby:
$gitremotev
Ifyouneedtodistributeyourproject(repository),youneedtopushthatprojecttogithub.Ifwe
needtopushmasterbranchtoyourgitrepositoryongithub(originserver),usethefollowing
command:
$gitpushoriginmaster
Conclusion:
Gitishighlyusedinthemarketasadistributedversioncontrolsystem.Manywellknown
companiesareusingGitformanagingtheirbigprojectsforversioncontrolling.Onemainreason
thatGitispopularisbecauseofGithub.
CodalInc
UXDesign&AppsDevelopmentAgency
www.codal.com