.gitignore: according to what rules does this work

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

 



I have the following directory layout and want to exclude
dir2 .. dirN

The following arrangement of .gitignore seems to work ok
but I was unable to find docs about the double asterisks.

./.gitignore:

*
*/
!.gitignore
!/dir1/


dir1/.gitignore:

!**
!**/

these two lines seem to be enough to have all subdirectories
within dir1 being included (which is desired) but why?

|-- .gitignore
|-- dir1
|   |-- .gitignore
|   |-- file1
|   |-- subdir1
|   |   |-- file1
|   |   `-- subsubdir1
|   |       |-- file1
|   |       `-- subsubsubdir1
|   |           `-- file1
|   `-- subdir2
|       `-- file1
|-- dir2
|   `-- file1
.
.
.
--- dirN
    `--file1

git add . says:
....
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   .gitignore
#       new file:   dir1/.gitignore
#       new file:   dir1/file1
#       new file:   dir1/subdir1/file1
#       new file:   dir1/subdir1/subsubdir1/file1
#       new file:   dir1/subdir1/subsubdir1/subsubsubdir1/file1
#       new file:   dir1/subdir2/file1

Before discovering this I was playing like this:

!*
!*/
!*/*
!*/*/ 

and so on.

Greetings,
Konrad
--
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]