git-commit.txt 2.0 KB
Newer Older
J
Junio C Hamano 已提交
1 2
git-commit(1)
=============
J
Junio C Hamano 已提交
3 4 5

NAME
----
J
Junio C Hamano 已提交
6
git-commit - Record your changes
J
Junio C Hamano 已提交
7 8 9

SYNOPSIS
--------
10
'git-commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg>] [-e] [--] <file>...
J
Junio C Hamano 已提交
11 12 13 14 15 16 17 18

DESCRIPTION
-----------
Updates the index file for given paths, or all modified files if
'-a' is specified, and makes a commit object.  The command
VISUAL and EDITOR environment variables to edit the commit log
message.

J
Junio C Hamano 已提交
19 20 21 22
This command can run `commit-msg`, `pre-commit`, and
`post-commit` hooks.  See link:hooks.html[hooks] for more
information.

J
Junio C Hamano 已提交
23 24
OPTIONS
-------
25
-a|--all::
J
Junio C Hamano 已提交
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
	Update all paths in the index file.

-c or -C <commit>::
	Take existing commit object, and reuse the log message
	and the authorship information (including the timestamp)
	when creating the commit.  With '-C', the editor is not
	invoked; with '-c' the user can further edit the commit
	message.

-F <file>::
	Take the commit message from the given file.  Use '-' to
	read the message from the standard input.

-m <msg>::
	Use the given <msg> as the commit message.

42
-s|--signoff::
J
Junio C Hamano 已提交
43 44
	Add Signed-off-by line at the end of the commit message.

45
-v|--verify::
J
Junio C Hamano 已提交
46 47 48 49 50
	Look for suspicious lines the commit introduces, and
	abort committing if there is one.  The definition of
	'suspicious lines' is currently the lines that has
	trailing whitespaces, and the lines whose indentation
	has a SP character immediately followed by a TAB
51
	character.  This is the default.
J
Junio C Hamano 已提交
52

53 54 55 56
-n|--no-verify::
	The opposite of `--verify`.

-e|--edit::
J
Junio C Hamano 已提交
57 58 59 60 61
	The message taken from file with `-F`, command line with
	`-m`, and from file with `-C` are usually used as the
	commit log message unmodified.  This option lets you
	further edit the message taken from these sources.

62 63 64
--::
	Do not interpret any more arguments as options.

J
Junio C Hamano 已提交
65
<file>...::
J
Junio C Hamano 已提交
66
	Update specified paths in the index file before committing.
J
Junio C Hamano 已提交
67 68


J
Junio C Hamano 已提交
69 70 71 72
If you make a commit and then found a mistake immediately after
that, you can recover from it with gitlink:git-reset[1].


J
Junio C Hamano 已提交
73 74
Author
------
J
Junio C Hamano 已提交
75 76 77
Written by Linus Torvalds <torvalds@osdl.org> and
Junio C Hamano <junkio@cox.net>

J
Junio C Hamano 已提交
78 79 80

GIT
---
81
Part of the gitlink:git[7] suite