Aug
20
2010

[Libertyvasion] Git for phpBB Developers

Session: Git for phpBB Developers by David Soria Parra
Date/Time: Friday 8/20 at 9:30-10:20 AM

This post contains my rough crib-notes from this presentation at Libertyvasion 2010. The post has not been proof-read for spelling, grammar, or accuracy.

Git was developed by Linus Torvalds in 2005, and is now used by a lot of open-source projects (such as phpBB).
Based on three main principles: Security, Distribution, and Performance.

Most version control systems do not verify that what goes into the system comes out the same way, such as Subversion. This can cause corruption. Git guarantees that what goes into the system comes out the same.
Performance is not as important for phpBB because its codebase is much smaller, but Git is designed to distribute files very quickly nevertheless. Git is the fastest version control system available at the moment.
Distribution is the big focus of this presentation, since it can be kind of confusing for the first time.

Imagine that we have Alice and Bob, which both share a central repository. With Distribution, there is no “central repository.” Instead, Bob has his own repository, and Alice can git clone / init and clone his repository for herself. There is no concept of a central repository in Git; instead everyone clones each other’s repositories. So if the wireless here in the hotel went out, we could still get the “main” repository off of some developer’s own repository here in this room.

The GitHub repository “acts” like a central repository — github.com/phpbb/phpbb3.git, but it’s not more or less important than the repository of any one developer. However end users and contributors can use GitHub to get a clone of the repository for themselves. Alice & Bob can both clone the GitHub repository, then (for example) Charles can clone Bob’s repository. Thanks to this distributed model, you can still commit even if you’re not connected to the internet. Or, say, if you’re not certain if a feature should be committed into a main repository or not, you can simply commit to your own repository, and it won’t necessarily affect anyone else’s until you want it to.

PHP.net has over 300 people with Subversion access, making it impossible for Subversion access to actually be managed.

GitHub is going to become one of the most important open source platforms in the next year or two — if a project is not on GitHub, they’re really going to be missing out on access to really good prospective developers.

David is now demonstrating how to use Git from the command-line (he’s not a big fan of GUIs). I’m not going to try to copy down the commands for this post, nor explain some of the technical concepts being demonstrated. Get a book, or wait to watch the video. ;)

Branches in Git are completely different from branches in Subversion; branches in Git are not directories (and trunk and tags are gone). Try to forget & unlearn what you did in Subversion!

In Git, you can make commits on any revision of the repository you’re using, even if it’s not the most current revision. Unlike in SVN, you don’t need to update to the latest revision before committing.

“If you understand this data structure, Git is probably the easiest version control system in the world. If you don’t, Git is probably the hardest version control system in the world.”

David is also explaining phpBB’s branching model, which was set up when phpBB transitioned to Git earlier this year, and also pointing out some common possible errors that can arise when working with Git (such as “fast forward”).

There is a master branch, a develop-olympus branch, and a develop branch in phpBB’s structure. Problem is, people coming from Subversion think that the master branch is like the trunk from Subversion. In reality, there is no development on the master branch at all. The develop-olympus is the 3.0.x line (for bug fixes) and the develop is the development for 3.1. The master branch merely holds the latest stable release of phpBB.
A prepared-release branch can be created when the release cycle is being prepared (RCs, etc.), and can allow for certain commits in the develop-olympus branch to be held off to a future release. However, if commits are made in the prepared-release branch, then those commits need to be merged back into the develop-olympus branch. “That is quite complicated, but if you don’t understand it, it’s not a big issue.”
Feature branches can also be created to allow developers to work and collaborate on a specific feature without impacting the main develop branch until it is complete. (This also allows things to be quickly and easily removed in the future.)

Best Practices & Warnings:
* Forget what you learned from Subversion. Just forget it — it’s better that way.
* Try to focus on a few commands. Don’t learn all 140 at once.
* Try to use the command-line if it’s possible for you. (Yes, it’s not designed to work with Windows, but it does work on Windows.) Once you understand how it really works, then you could start using a GUI client.
* Best Git clients: TortoiseGIT (Windows), Eclipse EGIT plugin, GitX (Mac), gitosis. GitX is probably the best of these.

“That was a bit much for 9:00 in the morning, but thanks for listening!”

Written by Douglas Bell in: Libertyvasion 2010 |

No Comments

Comments are closed.

RSS feed for comments on this post.


Copyright © 2007-2010 phpBB Weekly, some rights reserved under a Creative Commons License. Website powered by WordPress. Theme: TheBuckmaker. Background: Vlad Gerasimov.
Click here to view full copyright/legal attributions.