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

Bug: partially staged file is committed in whole, if there is another staged file

From
PBPaul Beckingham <paul@beckingham.net>
Date
Aug 17, 2014, 17:05 UTC
Message-ID
<96FA86FB-D017-470F-899F-EA0F6F28C1E4@beckingham.net>
If I have two modified files, and file1 is staged (git add file1), and file2 is partially staged (git add -p file2), and then try to commit only the partially staged file2, git commits *all* changes to file2, not just the staged part.
There is no bug without file1 also being staged.
Here is a transcript illustrating the problem:

$ uname -v Darwin Kernel Version 14.0.0: Tue Jul 29 16:22:25 PDT 2014; root:xnu-2782.1.62~4/RELEASE_X86_64

$ git version git version 2.1.0

$ git status -sb
## master
M  file1
MM file2
$ git commit file2 -m "adding patch"
[master 066a6e2] adding patch
 1 file changed, 2 insertions(+)

$ git status -sb ## master M file1 $

Regards, Paul

Next: Junio C Hamano
Message 1 of 2 in “Bug: partially staged file is committed in whole, if there is another staged file”
  1. Paul BeckinghamAug 17, 2014
  2. Junio C HamanoAug 17, 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.