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

Re: BUG: `git commit` adding unstaged chunks of files to commits on 2.33.0

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 31, 2021, 17:56 UTC
Message-ID
<xmqq4kb5v6p1.fsf@gitster.g>
In-Reply-To
<CAHBARKezrkKAs0ACbJ_fnxR-qWacQ5KKuVLwn0WyT7aR+4++pQ@mail.gmail.com>
Andrew Thorp <andrew.thorp.dev@gmail.com> writes:
Show 7 quoted lines
>> What did you do before the bug happened? (Steps to reproduce your issue)
>
> Edit a checked-in file, adding multiple chunks of lines to the file.
> Using `git add -p <file>`, stage one of the chunks, leave some chunks unstaged.
> After running `git status` the file should both in the section
> `Changes to be committed:` and `Changes not staged for commit`.
> Commit the changes.
How was the last "commit the changes" done exactly?  

If either "git commit -a" or "git commit <file>" was done, that would explain the symptom of having the entire up-to-date contents of <file> in the working tree recorded in the resulting commit. The former tells "take all changes in the working tree", the latter tells "take the version of <file> in the working tree as a whole", to Git to create a commit out of.

"git commit" without pathspec would have made a partial commit that records only the changes that were added with "git add -p" to the index, though.

Previous: Andrew ThorpNext: Andrew Thorp
Message 2 of 7 in “BUG: `git commit` adding unstaged chunks of files to commits on 2.33.0”
  1. Andrew ThorpAug 31, 2021
  2. Junio C HamanoAug 31, 2021
  3. Andrew ThorpAug 31, 2021
  4. Andrew ThorpAug 31, 2021
  5. Junio C HamanoAug 31, 2021
  6. Andrew ThorpAug 31, 2021
  7. Philippe BlainSep 1, 2021

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.