Category Archives: Git

Proper Git Commit Messages and an Elegant Git History

What should I include in my commit message?

The three basic things to include are a summary or title, a detailed description, and a tracking or ticket number, if it’s applicable.

via Proper Git Commit Messages and an Elegant Git History.

As we get started with using Git more regularly for our projects, I’m noticing a whole lot of merges. This article describes the value of using rebase instead of merge as well as giving some best practices for writing commit messages.

Drush aliases on your Vagrant dev environment

Note: This blog post is intended for members of the U of L web team and has some details specific to our own working environment. These instructions won’t work for everybody.

Drush aliases provide a handy way to run Drush commands on remote servers without having to ssh into that machine and navigate to the Drupal environment in which you want to work. When working in our Vagrant-controlled development environment, vagrant ssh isn’t a huge barrier, but if you want to be able to just reference your dev environment from your local Drush interface, this is how I’ve gone about it.

First of all, you need to make sure you have Drush running locally. If you try running drush at the command line and get -bash: drush: command not found, you need to install it. Homebrew will handle that quickly and easily with a simple brew install drush

Next, make sure that your virtual machine is running. If not, give it the ol’ drush up. Once you’ve done that, you’ll need to copy an SSH key over to your virtual machine with this command (You will need to repeat this step on each virtual machine that you are doing development on):

scp ~/.ssh/ vagrant@

Now, create a Drush alias file on your local machine in the ~/.drush folder. Mine is ~/.drush/dev.aliases.drushrc.php. Copy and paste this code block in there:

$aliases['dev'] = array(
'root' => '/vagrant/public',
'remote-host' => '',
'remote-user' => 'vagrant',

(Remember to start that file with an opening php tag … WordPress seems to think I’m doing something fishy and keeps stripping it out.)

Now, you can run Drush commands and include @dev to specify the Vagrant development environment as the target of your command, like so:

$ drush @dev status Drupal version : 7.26
Site URI : http://default
Database driver : mysql
Database username : root
Database name : drupal
Database : Connected
Drupal bootstrap : Successful
Drupal user : Anonymous
Default theme : bartik
Administration theme : seven
PHP executable : /usr/bin/php
PHP configuration : /etc/php5/cli/php.ini PHP OS : Linux
Drush version : 6.0-dev
Drush configuration :
Drush alias files :
Drupal root : /vagrant/public
Site path : sites/default
File directory path : sites/default/files
Temporary file directory path : /tmp

For more information on Drush aliases, check out the inline documentation in this example file:

Git Best Practices: Workflow Guidelines | Lullabot

We’ve been using Git here for a while, but it’s always good to get a best-practice refresher, and some workflow tips and tricks. Lullabot’s Andrew Berry has some good stuff on that front today:

Git is a flexible and powerful version control system. While Git offers significant functionality over legacy centralized tools like CVS and Subversion, it also presents so many options for workflow that it can be difficult to determine what is the best method to commit code to a project. The following are the guidelines I like to use for most software projects contained within a Git repository.

via Git Best Practices: Workflow Guidelines | Lullabot.

The “wonder” git documentation | drupal4hu

As we welcome Git as the new version control system for Drupal, there are probably many looking for good learning resources. This comes by way of chx:

lut4rp gave me a link today. I understood git. In minutes. Miracles! […]

The docs is at

Via The “wonder” git documentation | drupal4hu

I agree that Git becomes much more usable when you understand what’s going on under the hood. Another great resource for this is PeepCode’s Git Internals PDF ($12 well spent).