Skip to content

Commit d4ba07c

Browse files
Johannes Sixtgitster
authored andcommitted
Document option --only of git commit
Its documentation was removed by 6c96753 (Documentation/git-commit: rewrite to make it more end-user friendly, 2006-12-08), even though it is referenced from a few places, including builtin-commit.c (as part of the commentary in the commit message template). Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ca593f7 commit d4ba07c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Documentation/git-commit.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ but can be used to amend a merge commit.
139139
as well. This is usually not what you want unless you
140140
are concluding a conflicted merge.
141141

142+
-o|--only::
143+
Make a commit only from the paths specified on the
144+
command line, disregarding any contents that have been
145+
staged so far. This is the default mode of operation of
146+
'git commit' if any paths are given on the command line,
147+
in which case this option can be omitted.
148+
If this option is specified together with '--amend', then
149+
no paths need be specified, which can be used to amend
150+
the last commit without committing changes that have
151+
already been staged.
152+
142153
-u|--untracked-files::
143154
Show all untracked files, also those in uninteresting
144155
directories, in the "Untracked files:" section of commit

builtin-commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static struct option builtin_commit_options[] = {
9797
OPT_BOOLEAN('a', "all", &all, "commit all changed files"),
9898
OPT_BOOLEAN('i', "include", &also, "add specified files to index for commit"),
9999
OPT_BOOLEAN(0, "interactive", &interactive, "interactively add files"),
100-
OPT_BOOLEAN('o', "only", &only, ""),
100+
OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
101101
OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
102102
OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
103103
OPT_BOOLEAN(0, "untracked-files", &untracked_files, "show all untracked files"),

0 commit comments

Comments
 (0)