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

git-add ignores .gitignore

From
Brian Gernhardt <benji@silverinsanity.com>
Date
Dec 29, 2006, 15:51 UTC
Message-ID
<033682AF-B324-4049-B331-8A8AF2335E4D@silverinsanity.com>
I just ran "git add ." and got a very surprising result. Test case:

$ mkdir tmp $ git init-db $ mkdir a $ touch a/b c $ cat > .gitignore << EOF a EOF $ git status # On branch refs/heads/master # # Initial commit # # Untracked files: # (use "git add file1 file2" to include for commit) # # .gitignore # c nothing to commit (use "git add file1 file2" to include for commit) $ git add . $ git status # On branch refs/heads/master # # Initial commit # # Added but not yet committed: # (will commit) # # new file: .gitignore # new file: a/b # new file: c # $ git --version git version 1.5.0.rc0.g04509

Huh? I'm deep into my own code so can't diagnose it myself right now, but thought maybe someone on list could. I really hope that's not the expected behavior. Same thing happens with "git add *"

~~ Brian
Next: Junio C Hamano
Message 1 of 4 in “git-add ignores .gitignore”
  1. Brian GernhardtDec 29, 2006
  2. Fix 'git add' with .gitignore (Re: git-add ignores .gitignore)Junio C Hamano, Dec 29, 2006
  3. Brian GernhardtDec 30, 2006
  4. Brian GernhardtDec 30, 2006

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.