May 26, 2008

Patching files: try before apply

Here is a small tip that can be useful for developers.

Before you apply a patch, it is worth using --dry-run switch to see if it applies properly. However typing this switch all the time is not the best time spending. Fix it by creating an alias! Add the following to your ~/.bash_profile on Mac or to other known place on *nix systems:

alias "pdry=patch --dry-run"

Now you can use ptry -p0 < patchfile to try the patch before you apply it. Simple, isn't it?

Why didn't I add -p0 to the alias? Because not all patches are made over the right directory. So you may want to specify this option manually.

No comments:

Post a Comment