Fast Patches with Git

In my work, I deal with a lot of very similar codebases - and often if I fix something in one project I'll want to fix it in many others. For a long time this has meant popping open Beyond Compare, which works, but isn't the simplest solution.

I use git on my projects - but they're not similar enough just to be branches. Recently I came up with a way to patch one or more commits from a project to another easily. Here is a simple shell script I wrote to handle the task.

Simply put, you can use it either by

$ fast-patch.sh /z/my_project

to patch a project with the latest commit from the project in the working directory or with an optional parameter, specify a number of commits, eg

$ fast-patch.sh /z/my_project 5

Also, it will generate a patch log to ~/fastPatch.log which I generally use directly for my commit message by way of

$ git commit -F ~/fastPatch.log

Any comments on how I could improve it, or questions are quite welcome.