git

tl;dr: Define personal, project-specific shell commands as a git alias. It’s nice.

I moved to Jekyll for my blog in July. To run the blog on my dev machine I need to run

> bundle exec jekyll serve --baseurl ''

Not too crazy, but it’s a pain to remember every time I want to run the dev server.

I could put a helper script in the root of the directory for my personal blog, but that’s not an option with something like the Dart SDK.

> ./tools/build.py --mode=release --arch=ia32 create_sdk

I could put an a shell alias in my .profile, but it doesn’t make sense anywhere except the Dart SDK directory.

Enter git aliases.

I’ve written about my global git aliases, but I’ve started using project-local aliases and I’m loving ‘em.

For my blog, I tweak .../myblog/.git/config with:

[alias]
  jekyll-serve = !bundle exec jekyll serve --baseurl ''

For my clone of the Dart SDK:

[alias]
  create-sdk = "!./tools/build.py --mode=release --arch=ia32 create_sdk"

Try it out.

  • Scoped to the current directory.
  • Doesn’t add any extra files to the repo that need to be ignored.
  • Auto-complete nicely with git<tab>.