Help: commit

hg commit [OPTION]... [FILE]...

aliases: ci

commit the specified files or all outstanding changes

Commit changes to the given files into the repository. Unlike a centralized SCM, this operation is a local operation. See 'hg push' for a way to actively distribute your changes.

If a list of files is omitted, all changes reported by 'hg status' will be committed.

If you are committing the result of a merge, do not provide any filenames or -I/-X filters.

If no commit message is specified, Mercurial starts your configured editor where you can enter a message. In case your commit fails, you will find a backup of your message in ".hg/last-message.txt".

The --close-branch flag can be used to mark the current branch head closed. When all heads of a branch are closed, the branch will be considered closed and no longer listed.

The --amend flag can be used to amend the parent of the working directory with a new commit that contains the changes in the parent in addition to those currently reported by 'hg status', if there are any. The old commit is stored in a backup bundle in ".hg/strip-backup" (see 'hg help bundle' and 'hg help unbundle' on how to restore it).

Message, user and date are taken from the amended commit unless specified. When a message isn't specified on the command line, the editor will open with the message of the amended commit.

It is not possible to amend public changesets (see 'hg help phases') or changesets that have children.

See 'hg help dates' for a list of formats valid for -d/--date.

Returns 0 on success, 1 if nothing changed.

Examples:

  • commit all files ending in .py:
    hg commit --include "set:**.py"
    
  • commit all non-binary files:
    hg commit --exclude "set:binary()"
    
  • amend the current commit and set the date to now:
    hg commit --amend --date now
    

options ([+] can be repeated):

-A --addremove mark new/missing files as added/removed before committing
--close-branch mark a branch head as closed
--amend amend the parent of the working directory
-s --secret use the secret phase for committing
-e --edit invoke editor on commit messages
--force-close-branch forcibly close branch from a non-head changeset (ADVANCED)
-i --interactive use interactive mode
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-m --message TEXT use text as commit message
-l --logfile FILE read commit message from file
-d --date DATE record the specified date as commit date
-u --user USER record the specified user as committer
-S --subrepos recurse into subrepositories

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
--color TYPE when to colorize (boolean, always, auto, never, or debug)
--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
--pager TYPE when to paginate (boolean, always, auto, or never) (default: auto)