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

Re: Beginner problem with .gitignore

From
Kai Schlamp <schlamp@gmx.de>
Date
Apr 21, 2009, 09:57 UTC
Message-ID
<49ED988A.6030504@gmx.de>
In-Reply-To
<49ED8914.9090808@drmicha.warpmail.net>
Michael, thanks for the help. Comments below.
> By "is ignored", do you mean that git status doesn't show it? 
Yes, that is what I meant.
> git status does not recurse into subdirectories by default unless there 
> is at least one tracked file inside.

Ok. I justed tested this a bit. Let's say I have the following directory structure: "/a_dir/b_dir/c_dir"

And have a .gitignore with: /a_dir !/a_dir/b_dir/c_dir/

Now i put a file "a_file" in "c_dir". And add the a_file with "git add /a_dir/b_dir/c_dir/a_file". Yes, a_file is tracked now.

I would have expected (after your information above) that if I create another file "b_file" in "c_dir" and check "git status" that this file is on the untracked file list now. But it doesn't show up. And this makes it quite hard to exclude a whole folder, but only include one of it's subfolders. I use git gui for commits. And I like it that newly added files show up as untracked files. But in this case those files in those subdiretories won't.

Best regards, Kai

Previous: Michael J GruberNext: Michael J Gruber
Message 3 of 5 in “Beginner problem with .gitignore”
  1. Kai SchlampApr 20, 2009
  2. Michael J GruberApr 21, 2009
  3. Kai SchlampApr 21, 2009
  4. Michael J GruberApr 21, 2009
  5. Kai SchlampApr 21, 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.