smart-apply-patch

smart-apply-patch is a command to help apply patches easily. It uses the same plug-ins and many of the same options as test-patch. This means that it can, for example, fetch patches from JIRA and apply them to a local source tree.

Usage

Its simplest form is used when a patch is stored in a local file:

$ smart-apply-patch patch

This will cause the command to run through various ways to verify and then apply the patch to the current repo, including deducing a patch level.

Perhaps you just want to see if the patch even applies without changing your local repo. The --dry-run option will just test for applicability:

$ smart-apply-patch --dry-run patch

For committers of projects, there is a special mode:

$ smart-apply-patch --committer patch

that in addition to applying the patch will also attempt to:

  • use --whitespace=fix mode
  • add all newly created files in the repo
  • use --signoff and commit the change via git-am