Share
Embed
Git--distributed-is-the-new-centralized
What is version control, and why should you care? For a long time teams have been too blind for git... a little talk to change it.... FROM SVN TO GIT!
Hélio Medeiros
February 27, 2013
Transcript
28 slides
-
Git is a free and open source distributed version control
system, designed to handle everything from small to large projects with speed and efficiency. http://git-scm.com/ -
Considering the vision of Linus Torvalds “version control the way
it really should be” “cvs or based on their primitive?” -
MAY NOT BE A GOOD STARTING POINT ... Blaspheme
ON OUR CURRENT VERSION CONTROL SYSTEMS ... BUT ... HUMMM ... NEED TO GO AHEAD! -
What are the advantages? Small and Fast branching and merging
Distributed Data Assurance Staging Area Free Open Source http://git-scm.com/ -
#1 Git allows and encourages the creation of several local
branchs, that can be totally independent of each other. BRANCHING AND MERGING prod YES using trunk? YES NO TAG ? NO create tag trunk restore trunk tag create branch trunk warn? dev homol ok? reintegrate trunk branch create tag trunk local -
BRANCHING AND MERGING ! Frictionless Context Switching Create a branch
to try out an idea, commit a few times, switch back to where you branched from, apply a patch, switch back to where you are experimenting, and merge it in! ! Role-Based Codelines Have a branch that always contains only what goes to production, another that you merge work into for testing, and several smaller ones for day to day work. ! Feature Based Workflow Create new branches for each new feature you're working on so you can seamlessly switch back and forth between them, then delete each branch when that feature gets merged into your main line. ! Disposable Experimentation Create a branch to experiment in, realize it's not going to work, and just delete it - abandoning the work—with nobody else ever seeing it. http://git-scm.com/ -
#2 Git is fast. With Git, nearly all operations are
performed locally, giving you a huge advantage SMALL AND FAST -
SMALL AND FAST Commit Files(A) Add, commit and push 113
modified files 0 1.3 2.6 git svn 2.6 0.64 Commit Images(B) Add, commit and push 1000 1k images 0 15 30 git svn 24.7 1.53 Diff Local Diff 187 changed files against last commit 0 0.55 1.1 git svn 1.09 0.25 Diff Files Diff against 4 commits back (269 changed) 0 2 4 git svn 3.99 0.25 Diff Tags Diff two tags against each other (v1.9.1.0/v1.9.3.0 ) 0 45 90 git svn 83.57 1.17 http://git-scm.com/ Update Pull of Commit A scenario (113 modified files) 0 1.5 3 git svn 2.82 0.9 -
SMALL AND FAST Log (All) Log of all commits (26.056
commits) 0 90 180 git svn 169.2 0.52 Log (50) Log of the last 50 commits 0 0.2 0.4 git svn 0.38 0.01 Blame Line annotation of a single file (array.c) 0 1.6 3.2 git svn 3.04 1.91 http://git-scm.com/ Log (File) Log of the history of a single file (array.c - 483 reviews) 0 45 90 git svn 82.84 0.6 -
SMALL AND FAST Commit Arquivos(A) Add, commit e push 113
arquivos modificados 0 1.3 2.6 git svn 2.6 0.64 Commit Imagens(B) Add, commit e push de 1000 imagens de 1Kb 0 15 30 git svn 24.7 1.53 Diff Local Diff de 187 arquivos alterados locais contra o último commit. 0 0.55 1.1 git svn 1.09 0.25 Diff Arquivos Diff entre versão atual e outra 4 commits atrás (269 alterados) 0 2 4 git svn 3.99 0.25 Diff Tags Diff entre duas tags (v1.9.1.0/v1.9.3.0 ) 0 45 90 git svn 83.57 1.17 http://git-scm.com/ Update Pull do cenário do Commit A (113 arquivos alterados) 0 1.5 3 git svn 2.82 0.9 GIT IS FASTER THAN SVN 4x 16x 4x 16x 71x 3x -
SMALL AND FAST Log (Todos) Log de todos os commits
(26.056 commits) 0 90 180 git svn 169.2 0.52 Log (50) Log dos últimos 50 commits 0 0.2 0.4 git svn 0.38 0.01 Blame Anotações em um único arquivo (array.c) 0 1.6 3.2 git svn 3.04 1.91 http://git-scm.com/ Log (Arquivo) Log do histórico de um arquivo (array.c - 483 revissões) 0 45 90 git svn 82.84 0.6 GIT IS FASTER THAN SVN 325x 31x 138x 1x -
#3 Instead of doing a "check-out" of the current situation
of the source code, you make a "clone" of the entire repository. DISTRIBUTED -
DISTRIBUTED Any Workflow Because of Git's distributed nature and superb
branching system, an almost endless number of workflows can be implemented with relative ease. Multiple Backups Even if you are using a centralized workflow, each user will have a full backup of the primary server. Each of these copies may overwrite the primary server in the event of an accident or corruption. In effect, there is no single point of failure with Git unless there is only a single copy of the repository. http://git-scm.com/ -
Subversion-Style Workflow A centralized workflow is very common, especially from
people transitioning from a centralized system http://git-scm.com/ DISTRIBUTED -
Workflow distributed and decentralized For teams that overlap a formal
teams, the model allows for a distributed collaborative organization simple and organized. http://git-scm.com/ origin origin PROJETO OPEN SOURCE 1 origin origin PROJETO OPEN SOURCE 2 DISTRIBUTED -
{ http://git-scm.com/ fetch merge + origin/master master origin localhost PULL
The pull command performs two operations, holds first fetches bringing all the files and then performs a merge with your local repository. DISTRIBUTED -
http://git-scm.com/ push origin localhost PUSH The push command performs the
sending of the information packet to your local repository couple the desired server. Even if the repository does not exist on the server in question. push notebook $git push origin projeto1 $git push notebook projeto1 DISTRIBUTED -
#4 It is impossible to get anything inside the Git
beyond the exact bits you put DATA ASSURANCE -
DATA ASSURANCE Cryptographic integrity The data model that Git uses
ensures the cryptographic integrity of every bit of your project. Every file and commit is checksummed and retrieved by its checksum when checked back out. It's impossible to get anything out of Git other than the exact bits you put in. http://git-scm.com/ -
#5 Commits can be formatted and reviewed before completing the
submission. STAGING AREA -
STAGING AREA Staging Area Git has something called a "staging
area" or "index", which serves as the intermediate area where the commits can be formatted and reviewed before completing the submission. Thus it is possible to quickly change some of your files and checks in them without committing all other modified your working directory, or having to list them for confirmation. http://git-scm.com/ working directory staging area repository git add git commit git commit -a working directory staging area repository -
#6 Use Git in open projects or owners for free,
forever. FREE -
FREE Under Git's GPLv2 software license you may Use Git
on open or proprietary projects for free, forever; Call Git binaries from your open or proprietary programs; http://git-scm.com/ -
#7 Download and inspect the source code at any time
or contribute to the project yourself OPEN SOURCE -
OPEN SOURCE http://git-scm.com/ Under Git's GPLv2 software license you may
Download, inspect and modify the source code to Git; Make proprietary changes to Git that you do not redistribute publicly; Publicly redistribute Git binaries with open or proprietary programs, given that they are unmodified or the modifications are public;