Git in one Evening● Who am I, and what is my context?● Why use version control at all?● What are the options?● Why choose git?● Git basics● Github goodies● Git as part of your workflow● Questions and discussion
Who am I, anyway?● Long time developer (perl, php)● Primarily work in Drupal● I work with a small team – Im the primaryback-end dev, we have one themer● I do sometimes contribute to the Drupalproject.
Why use version control?● Also called “revision control” or “sourcecontrol”● Use cases (code == text files)– Solo, CMS site building, no custom code(useful at times)– Solo, CMS site building, custom code (themefiles, etc.) (very useful)– Solo or Team, custom code (essential)– Team, CMS site building, custom code(essential)
Version Control Options● Old skool: CVS/SVN (client/server)● New skool: Git, Bazaar, Mercurial (distributed)● Git is by far the most popular, and hasbecome the industry standard for versioncontrol. Used for the Linux kernel● Mercurial is used by Python, and others● Bazaar is used by Ubuntu, and supported byCanonical
Distributed Version Control● SVN (and its predecessor, CVS) had onlyone repository, and it was central. Youcommitted code to that repository. Yourworking copy is only a copy of the code, withmetadata (in the form of .svn directories).● With distributed version control, everyone hasa repository – so every version is basically afork.
Distributed Version Control, cont.● Synchronization can happen by peersexchanging patches● Commits, reverts, etc. are fast, because theyhappen locally.● You can work productively (like on a plane)without having to connect to a server● Branching and forking are a lot easier● It is easier to contribute to open sourceprojects
Why Learn Git?● It is distributed version control● It is the most popular● It is used for the drupal project (I noticewordpress is still using SVN.)● It is in increasing use in PaaS systems(Heroku, etc.)● Youll improve your chances of getting a job(git knowledge is increasingly asked for.)
How to get git● Linux– apt-get install git (Ubuntu/Debian)– yum install git-core (Fedora/CentOS)– Download from http://git-scm.com/● Mac OS X– Graphical Gitinstaller:http://code.google.com/p/git-osx-installer– MacPorts● Windows– http://msysgit.github.io/
Git Tools● IDEs/Editors that integrate with git– Eclipse– Netbeans– TextMate● Git GUIs– Gitg– Katana– Others● https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools
Git Repository Hosting● You could theoretically do peer-to-peer, butthe standard is to have a “bare” repositoryhosted somewhere● You can easily host it yourself on a VPS● Commercial hosting options provide goodies– GitHub– Bitbucket– Others
GitHub● github.com● Free for open source/public projects● Modest cost for private repository hosting● Lots of nice goodies, including issue tracking
Git Workflow● Depends on use case● Teams● Branches● Remotes as “servers” a la cvs/svn● Challenges integrating with DB based CMSconfig changes