Mercurial > hg > flattendynamics
Help: graft
hg graft [OPTION]... [-r REV]... REV...
copy changes from other branches onto the current branch
This command uses Mercurial's merge logic to copy individual changes from other branches without merging branches in the history graph. This is sometimes known as 'backporting' or 'cherry-picking'. By default, graft will copy user, date, and description from the source changesets.
Changesets that are ancestors of the current revision, that have already been grafted, or that are merges will be skipped.
If --log is specified, log messages will have a comment appended of the form:
(grafted from CHANGESETHASH)
If --force is specified, revisions will be grafted even if they are already ancestors of or have been grafted to the destination. This is useful when the revisions have since been backed out.
If a graft merge results in conflicts, the graft process is interrupted so that the current merge can be manually resolved. Once all conflicts are addressed, the graft process can be continued with the -c/--continue option.
Note:
The -c/--continue option does not reapply earlier options, except for --force.
Examples:
- copy a single change to the stable branch and edit its description:
hg update stable hg graft --edit 9393
- graft a range of changesets with one exception, updating dates:
hg graft -D "2085::2093 and not 2091"
- continue a graft after resolving conflicts:
hg graft -c
- show the source of a grafted changeset:
hg log --debug -r .
- show revisions sorted by date:
hg log -r 'sort(all(), date)'
See 'hg help revisions' and 'hg help revsets' for more about specifying revisions.
Returns 0 on successful completion.
options ([+] can be repeated):
-r | --rev REV [+] | revisions to graft |
-c | --continue | resume interrupted graft |
-e | --edit | invoke editor on commit messages |
--log | append graft info to log message | |
-f | --force | force graft |
-D | --currentdate | record the current date as commit date |
-U | --currentuser | record the current user as committer |
-d | --date DATE | record the specified date as commit date |
-u | --user USER | record the specified user as committer |
-t | --tool VALUE | specify merge tool |
-n | --dry-run | do not perform actions, just print output |
global options ([+] can be repeated):
-R | --repository REPO | repository root directory or name of overlay bundle file |
--cwd DIR | change working directory | |
-y | --noninteractive | do not prompt, automatically pick the first choice for all prompts |
-q | --quiet | suppress output |
-v | --verbose | enable additional output |
--config CONFIG [+] | set/override config option (use 'section.name=value') | |
--debug | enable debugging output | |
--debugger | start debugger | |
--encoding ENCODE | set the charset encoding (default: UTF-8) | |
--encodingmode MODE | set the charset encoding mode (default: strict) | |
--traceback | always print a traceback on exception | |
--time | time how long the command takes | |
--profile | print command execution profile | |
--version | output version information and exit | |
-h | --help | display help and exit |
--hidden | consider hidden changesets |