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

Behavior of 'git add \*.txt': bug or feature?

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Sep 16, 2009, 19:46 UTC
Message-ID
<vpqljke7jv8.fsf@bauges.imag.fr>
Hi,

I find the behavior of 'git add \*.txt' strange: for adding untracked files, it considers \*.txt as a pattern to match, but for updating existing file's staged content, it seems to consider it as a filename:

$ git status # On branch master # Changed but not updated: # # modified: three.txt # modified: two.txt # # Untracked files: # # one.txt no changes added to commit (use "git add" and/or "git commit -a") $ git add -v '*.txt' add 'one.txt' $ git add -v '*.txt' $

I would have expected this "git add -v '*.txt'" to update the staged content of two.txt and three.txt too.

It this the intended behavior? If so, what's the rationale for this?
Thanks,
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Next: Junio C Hamano
Message 1 of 4 in “Behavior of 'git add \*.txt': bug or feature?”
  1. Matthieu MoySep 16, 2009
  2. Junio C HamanoSep 16, 2009
  3. Matthieu MoySep 16, 2009
  4. Clemens BuchacherSep 17, 2009

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.