Re: Beginner problem with .gitignore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kai Schlamp venit, vidit, dixit 21.04.2009 11:57:
> 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.

That's for the case when you don't ignore that dir.

> 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.

The problem is the recursive way in which git applies those patterns.
Your patterns above mean that git never recurses into the subdirs.

In the example above, you probably want

/a_dir/b_dir/*
!/a_dir/b_dir/c_dir/

Cheers,
Michael

P.S.: Please don't cull cc:
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]