git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Document option --only of git commit

From
PBPieter de Bie <pdebie@ai.rug.nl>
Date
Apr 18, 2008, 09:28 UTC
Message-ID
<9CE1A95F-941C-474F-9F18-1B01B73113B2@ai.rug.nl>
In-Reply-To
<1207827189-7509-2-git-send-email-johannes.sixt@telecom.at>
Hi,
On 10 apr 2008, at 13:33, Johannes Sixt wrote:
Show 7 quoted lines
> Its documentation was removed by  
> 6c96753df9db7f790a2ac4d95ec2a868394cd5ff,
> 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 <johannes.sixt@telecom.at>
Show 11 quoted lines
> +-o|--only::
> +	Make a commit only from the paths specified on the
> +	command line, disregarding any contents that have been
> +	staged so far. This is the default mode of operation of
> +	'git commit' if any paths are given on the command line,
> +	in which case this option can be omitted.
> +	If this option is specified together with '--amend', then
> +	no paths need be specified, which can be used to amend
> +	the last commit without committing changes that have
> +	already been staged.
> +

I find this addition to the manpage very confusing. If -o commits paths only from the command line, and it is also the default operation when run with paths, why is this text at the -o option? This behaviour is already documented in the description of git-commit:

        3. by listing files as arguments to the commit command, in  
which case the commit will
           ignore changes staged in the index, and instead record the  
current content of the
           listed files;

I'd suggest only using the second part (about --amend), or optionally adding something about what happens if you specify -o without --amend and without paths.

- Pieter
Previous: Johannes Sixt
Message 3 of 3 in “builtin-commit.c: Remove a redundant assignment.”
  1. builtin-commit.c: Remove a redundant assignment.Johannes Sixt, Apr 10, 2008
  2. Document option --only of git commitJohannes Sixt, Apr 10, 2008
  3. Pieter de BieApr 18, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.