170 likes | 352 Views
Gotta get Git Chris Sherwood and Alfredo Aretxabaleta USGS Woods Hole. Git documentation. Git - - distributed-is-the-new-centralized http://git-scm.com/doc Git for SVN users http://git-scm.com/course/svn.html “Pro Git ” – Scott Chacon (also online)
E N D
Gotta get GitChris Sherwood and Alfredo AretxabaletaUSGS Woods Hole
Git documentation • Git - - distributed-is-the-new-centralized http://git-scm.com/doc • Git for SVN users http://git-scm.com/course/svn.html • “Pro Git” – Scott Chacon (also online) • “Pragmatic Guide to Git” – Travis Swicegood • CRS attempts http://csherwood.tiddlyspot.com/
Advantages • Designed for distributed development • All local repos are complete • Anybody can make a local archive • You can pull from any archive you have access to • Most operations are local (faster, work offline) • Integrity: everything is check-summed • Only adds data (maybe safer) • Lightweight, local branches • GUI tools and hosting services similar SVN
Disadvantages • A(nother) learning curve • Sometimes TM(U)I • Also, sometimes too much typing
Installation • Linux, Cygwin often have git, but if not: $ sudo apt-get install git-core • Mac can get it via MacPorts $ sudo port install git-core +svn +doc +bash_completion +gitweb • Windows http://code.google.com/p/msysgit Modified after “Pro Git”
First-time user setup Important $ gitconfig --global user.name “csherwood (ubuntu)“ $ gitconfig --global user.emailcsherwood@usgs.gov Optional $ gitconfig --global core.editorxemacs $ gitconfig --global merge.tool meld Check settings $ gitconfig --list Modified after “Pro Git”
Centralized Repository From “Pro Git”
Distributed Repositories From “Pro Git”
ROMS and CSTMS SVN ? CSTMS trunk ROMS trunk svn copy crs branch dev2 branch svn checkoutsvn updatesvn commit dev3 branch svn checkoutsvn updatesvn commit svn checkoutsvn update Hernan trunkworking copy crs trunkworking copy ? ? crs branchworking copy
COAWST GIT COAWST origin/master git clone crsorigin/master kumarorigin/master git pullgit push git fetch git pullgit push git pullgit push git fetch git fetch Warnermaster track kumar branch track crs branch... crs master sed branchtrack kumar branch kumar masterwec branch
Branch Development Arrows point back to snapshots seds waves Modified after “Pro Git”
First attempt • Check out copy COAWST from SVN • Export from SVN to gcoawst • In gcoawst gitinit gitadd * git commit • Make a bare repository (no working dir) git clone --bare gcoawstgcoawst.git scp –r gcoawst.git csherwood@peach.whoi.edu:/peach/data2/csherwood/src/gcoawst.git
First attempt, second page • crs cloned it • ala cloned it • ala made a branch and switched to it • ala added the new sediment stuff to the branch and committed it • crs made a branch that tracked ala’s repo • crs fetched ala’s changes • crs merged them into his master • crs pushed them up to the repository • new users can clone/pull new sediment stuff from the repository
A few things we could not have done with SVN • Made our own shared repository based on the source repo (without admin) • Merged Alfredo’s branch into my branch without going to a repo • Its faster… • …but confusing
If we wanted to try it… • Pick a stopping point…maybe make a tagged SVN release • Use the tools to port the SVN history to git • Let John work on it for a while, allowing people to clone it • Pick a project to track, and work out the protocol for tracking branches • Hey, if Linus Torvalds can do it….