Git Branch
BecauseabranchinGitisinactualityasimplefilethatcontainsthe40characterSHA-1checksumofthecommititpointsto,branchesarecheaptocreateanddestroy.Creatinganewbranchisasquickandsimpleaswriting41bytestoafile(40charactersandanewline).
Toseethelastcommitoneachbranch,youcanrungitbranch-v:
Let’ssayyouhaveaGitserveronyournetworkatgit.ourcompany.com.Ifyouclonefromthis,Gitautomaticallynamesitoriginforyou,pullsdownallitsdata,createsapointertowhereitsmasterbranchis,andnamesitorigin/masterlocally;andyoucan’tmoveit.Gitalsogivesyouyourownmasterbranchstartingatthesameplaceasorigin’smasterbranch,soyouhavesomethingtoworkfrom
Tosynchronizeyourwork,yourunagitfetchorigincommand.Thiscommandlooksupwhichserveroriginis(inthiscase,it’sgit.ourcompany.com),fetchesanydatafromitthatyoudon’tyethave,andupdatesyourlocaldatabase,movingyourorigin/masterpointertoitsnew,moreup-to-dateposition(seeFigure3-24).
gitremoteaddteamonegit://git.team1.ourcompany.com
Now,youcanrungitfetchteamonetofetcheverythingtheremoteteamoneserverhasthatyoudon’thaveyet.