1CG-PATCH(1)                                                        CG-PATCH(1)
2
3
4

NAME

6       cg-patch - apply a patch from a file, standard input, or a commit
7

SYNOPSIS

9       cg-patch [-c] [-C COMMIT] [-pN] [-R] [-m | -d DIR] [OTHER_OPTIONS] <
10       PATCH
11
12

DESCRIPTION

14       Apply a patch in a manner similar to the patch tool, but while also
15       handling the Git extensions to the diff format: file mode changes, file
16       renames, distinguishing removal of files and empty files, etc. Newly
17       created files are automatically cg-add(1)ed and removed files are
18       cg-rm(1)oved.
19
20       cg-patch(1) can also automatically commit the applied patches and
21       extract patches from existing commits, therefore effectively enabling
22       you to cherrypick certain changes from a different branch.
23
24       In comparison with the git-apply tool, cg-patch(1) will also apply
25       fuzzy patches.
26
27

OPTIONS

29       -c     Automatically extract the commit message and authorship
30              information (if provided) from the patch and commit it after
31              applying it successfully.
32
33       -C COMMIT
34              Instead of applying a patch from stdin, apply and commit the
35              patch introduced by the given commit. This is basically an
36              extension of cg-commit -c, it also applies the commit diff.
37
38              In combination with -R, this does the opposite - it will revert
39              the given commit and then try to commit a revert commit - it
40              will prefill the headline and open the commit editor for you to
41              write further details.
42
43              Note that even though this is functionally equivalent to the
44              cherry-picking concept present in other version control systems,
45              this does not play very well together with regular merges and if
46              you both cherry-pick and merge between two branches, the picking
47              may increase the number of conflicts you will get when merging.
48
49       -d DIRNAME
50              Instead of applying a patch from stdin, apply and separately
51              commit all patches in the specified directory. This can be used
52              to import a range of patches made by cg-mkpatch -d. Implies -c.
53
54       -e     Edit the commit message before performing a commit. Makes sense
55              only with -c or other options implying -c (e.g.  -m).
56
57       -m     Applies series of patches in a mailbox fed to the command's
58              standard input. Implies -c.
59
60       -pN    Strip path of filenames in the diff to the level N. This works
61              exactly the same as in the patch tool except that the default
62              strip level is not infinite but 1 (or more if you are in a
63              subdirectory; in short, cg-diff | cg-patch -R and such always
64              works).
65
66       -R     Apply the patch in reverse (therefore effectively unapply it).
67              Implies -e except when the input is not a tty.
68
69       --resolved
70              In case the patch series application failed in the middle and
71              you resolved the situation, running cg-patch with with the -d or
72              -m argument as well as --resolved will cause it to pick up where
73              it dropped off and go on applying. (This includes committing the
74              failed patch; do not commit it on your own!) (For -m, you don't
75              need to feed the mailbox on stdin anymore.)
76
77       -s, --signoff[=STRING]
78              Add Signed-off-by line at the end of the commit message when
79              autocommitting (-c, -C, -d or -m). Optionally, specify the exact
80              name and email to sign off with by passing: --signoff="Author
81              Name <user@example.com>".
82
83       -u     Make cg-patch(1) assume the patch on the input is a classic
84              unified diff instead of a diff produced by GIT or Cogito. This
85              means only that file adds and removals will be recorded even if
86              the patch file does not explicitly describe them. Use this if
87              the patch was not produced by cg-diff(1) or similar but by a
88              traditional diff tool.
89
90              Takes the diff on stdin (unless specified otherwise).
91
92       -h, --help
93              Print usage summary.
94
95       --long-help
96              Print user manual. The same as found in cg-patch(1).
97
99       Copyright © Petr Baudis, 2005
100
101

SEE ALSO

103       cg-patch is part of cogito(7), a toolkit for managing git(7) trees.
104
105
106
107
108                                  12/11/2006                       CG-PATCH(1)
Impressum