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

Re: git commit --only -- $path when $path already has staged content

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 7, 2014, 16:57 UTC
Message-ID
<xmqqioirgd7v.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqmw83gd94.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 26 quoted lines
> Stefan Näwe <stefan.naewe@atlas-elektronik.com> writes:
>
>> The manpage of git commit reads:
>>
>>   --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. [...]
>
> "--only" is as opposed to "--also".  Two modes of partial commits
> are:
>
>  - "--also" which updates the index with the whole contents of the
>    given paths and record the resulting index as the tree of the new
>    commit;
>
>  - "--only" which starts from a new temporary index initialized from
>    HEAD with the whole contents of the given paths and record the
>    resulting index as the tree of the new commit, and then updates
>    the original index with the whole contents of the give paths.
>
> In other words, you give paths from the command line to tell the
> command that you want to record the contents of them in the working
> tree as a whole to be recorded in the resulting commit.

s/also/include/; "--also" was its original name of the option while it was in development.

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “git commit --only -- $path when $path already has staged content”
  1. Stefan NäweNov 7, 2014
  2. Junio C HamanoNov 7, 2014
  3. Junio C HamanoNov 7, 2014
  4. Junio C HamanoNov 7, 2014
  5. Stefan NäweNov 10, 2014

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.