SYNOPSIS

cg-patch [-c] [-C COMMIT] [-pN] [-R] [-u] [OTHER_OPTIONS] < PATCH

DESCRIPTION

This is basically just a smart patch wrapper. It handles stuff like mode changes, removal of files vs. zero-size files etc.

OPTIONS

-c

Automatically extract the commit message and authorship information (if provided) from the patch and commit it after applying it successfuly.

-C COMMIT

Instead of applying a patch from stdin, apply and commit the patch introduced by the given commit. This is basically an extension of cg-commit -c.

In combination with -R, this does the opposite - it will revert the given commit and then try to commit a revert commit - it will prefill the headline and open the commit editor for you to write further details.

Note that even though this is functionally equivalent to the cherry-picking concept present in other version control systems, this does not play very well together with regular merges and if you both cherry-pick and merge between two branches, the picking may increase the number of conflicts you will get when merging.

-d DIRNAME

Instead of applying a patch from stdin, apply and separately commit all patches in the specified directory. This can be used to import a range of patches made by cg-mkpatch -d. Implies -c.

-pN

Strip path of filenames in the diff to the level N. This works exactly the same as in the patch tool except that the default strip level is not infinite but 1 (or more if you are in a subdirectory; in short, cg-diff | cg-patch -R and such always works).

-R

Apply the patch in reverse (therefore effectively unapply it).

--resolved

In case -d failed in some patch in the middle with conflicts and you resolved them, running cg-patch with with the -d argument as well as --resolved will cause it to pick up where it dropped off and go on applying. (This includes committing the failed patch; do not commit it on your own!)

-u

Make cg-patch(1) assume the patch on the input is a classic unified diff instead of a diff produced by GIT or Cogito. This means only that file adds and removals will be recorded even if the patch file does not explicitly describe them. Use this if the patch was not produced by cg-diff(1) or similar but by a traditional diff tool.

Takes the diff on stdin (unless specified otherwise).

-h, --help

Print usage summary.

--long-help

Print user manual. The same as found in cg-patch(1).

COPYRIGHT

Copyright © Petr Baudis, 2005

SEE ALSO

cg-patch is part of cogito(7), a toolkit for managing git(7) trees.