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

Possible Bug with `git commit -a` in v2.41.0

From
DBDylan Brotherston <dylanb@cse.unsw.edu.au>
Date
Jul 3, 2023, 18:18 UTC
Message-ID
<ZKMRAkH1r2mQ85Ff@vx12.orchestra.cse.unsw.EDU.AU>
`git commit -a` is unable to remove the last file in the index in v2.41.0
 
comparing git version 2.30.2 to 2.41.0
 
```
$ git --version
git version 2.30.2
$ git init
Initialized empty Git repository in /tmp/tmp.vXqq6iVaqq/.git/
$ echo "foo" > a
$ git add a
$ git commit -m "C1"
[master (root-commit) b3abdc4] C1
 1 file changed, 1 insertion(+)
 create mode 100644 a
$ rm a
$ git commit -a -m "C2"
[master c3d4c44] C2
 1 file changed, 1 deletion(-)
 delete mode 100644 a
```
 
```
$ git --version
git version 2.41.0
$ git init
Initialized empty Git repository in /tmp/tmp.vXqq6iVaqq/.git/
$ echo "foo" > a
$ git add a
$ git commit -m "C1"
[master (root-commit) af7c07d] C1
 1 file changed, 1 insertion(+)
 create mode 100644 a
$ rm a
$ git commit -a -m "C2"
On branch master
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    a
 
no changes added to commit (use "git add" and/or "git commit -a")
```
 
- Dylan Brotherston
Next: Jeff King
Message 1 of 2 in “Possible Bug with `git commit -a` in v2.41.0”
  1. Dylan BrotherstonJul 3, 2023
  2. Jeff KingJul 3, 2023

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.