Wednesday, September 9, 2009

git utilities workflow

One of my best workflow techniques it to use git cherry-pick to pull in what I call utility changes. A utility change would be like a change to point all the database configuration at the test database. Normally it's pointed at your local database. It takes a few minutes to make the change to the test database and sometimes you forget a spot. So to do it I first...

-- make the change to point at the test database --

# stash all your changes so you can checkout your utility branch
git stash

# checkout utility branch
git checkout utils

# put your changes back
git stash apply

# commit your changes to your utility branch
git commit -a -m "Point environment at the test database"

# switch back to the branch you were working on, trunk probably
git checkout trunk

# double check what branch you are on since you don't want to make a mistake
git branch

# find the commit sha number for those changes you just committed
git log utils

# cherry-pick just the change
git cherry-pick ab38b9

-- now you test your site against the test db --

-- you find out whatever you were looking for --

# get rid of the cherry picked commit from your branch and change back to pointing your database locally
git reset --hard HEAD^

your utility commit is still in your utils branch history so you can just git cherry-pick ab38b9 it out anytime you want and point at the test database.

Friday, September 4, 2009

Caps-lock escape

So I've been using vim for awhile now and finally changed my caps-lock to be my escape key instead of using Ctrl-[ which is just too painful a keystroke. I used was using that keyboard combination instead of the normal escape key because the normal escape key is way up in top left corner :0 Who ever would have put it up there? I guess the escape key used to be decently located on very old systems which is why it is being used for vim. Using the caps-lock key now I can change modes with one key, suitably located. Ahhhhh, that feels better.
Here's a link:
http://www.terminally-incoherent.com/blog/2007/08/02/remapping-the-caps-lock-key/