How to Export a Single File Form a Git Revision to the Local Working Copy

I needed to test an older version of a file in a web app, but didn't want to checkout the entire codebase. The method below allowed me to easily checkout an older version of the file using the commit hash that I knew had the correct file. Other git object references such as tags, branches, and commits from HEAD can be used instead of the commit hash (full or short SHA). See details here.

$ git show [commit-hash]:/path/to/file/file.txt > file.txt

Blog Category: 

Sublime Text 2 Find Function Definition Package

I have some friends who use Eclipse for development. While I see the draw to a full-fledged IDE, I do not enjoy the weight that is required. I prefer a non-Java (native Cocoa compiled) and lightweight text-editor on my Mac. While I really enjoy Sublime Text 2, I have been jealous of Eclipse’s “F3 Open Declaration” capability. Eclipse allows you to track a class, function, or variable to its initial declearation. I especially want to track functions decleration’s in my Drupal projects.

Blog Category: 

Setup postfix to relay local mail in OS X Mountain Lion

I generally get by without needing to send email from any of my local development web applications. Of course, that was until today. I have an issue to dubug in the Guardr Drupal distribution and am getting some sendmail errors when running drush qd.

A bit of research resulted in getting postfix up and running as a sendmail service in OS X Mountain Lion (10.8.2). Here are the steps which worked for me:

Blog Category: 

Excluding files from git

Three very useful ways to eclude files and folders from git:

  1. Add a .gitignore file to your home directory and add files and folders you want all of your local git repos to ignore. For example: My .gitignore file.

  2. Add a .gitignore file to your local repo, stage, and commit the file as part of your codebase. This is very handy if you want to share a common set of files/folders to ignore with others working with the same upstream repo.

  3. Add files and folders to .git/info/exclude. The exclude file is found in every git repo and allows you to set ignore rules that will only work for your local repo. It will not get sent upstream during a push.

Checkout this excellent github help page for more details and examples!

Blog Category: