-1

the gitignore file does not exclude the marked directory, because it contains dots in its name: 'V1.0.0'. Is there any resolution for this problem?

gitignore file:

#exclude everything from version control 
*.*

#add desired directories to version control  
!a-V*/**

directory list: (every directory includes a simple text file)

a-V1.0.0   (<-- notice the dots)
a-V2-0-0
a-V3-0-0
b-V1-0-0
b-V2-0-0

output from git status: (file a1.txt in a-V1.0.0 is missing)

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)  
    new file:   a-V2-0-0/a2.txt  
    new file:   a-V3-0-0/a3.txt
Progman
  • 16,827
  • 6
  • 33
  • 48
claus
  • 21
  • 2
  • 1
    Please [edit] your question to include the output of "git status". – Progman Jun 26 '20 at 13:38
  • 1
    Also add the content of the `.gitignore` file and the directory listing in the question itself, not as screenshot. – Progman Jun 26 '20 at 13:41
  • You might want to look at https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder – Progman Jun 26 '20 at 13:45
  • Please remove the closed attribute. This is a still existing, serious problem. As desired, I added text instead of the pictures. The pictures did show the problem precisely, I hope the text can do equal. – claus Jun 29 '20 at 09:32
  • Have you checked the other questions like https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder and https://stackoverflow.com/questions/1248570/how-do-i-tell-git-to-ignore-everything-except-a-subdirectory which have several solutions? – Progman Jun 29 '20 at 17:25
  • Yes, I have checked the forum and the provided links. The reported problems are different from mine. My gitignore works properly and as desired, but git will struggle if the pathnames in gitignore contains dots (like version IDs typically have, see sample above) – claus Jun 30 '20 at 15:06
  • I think it would be helpful to receive more answers, if the closed attribute would be removed. – claus Jun 30 '20 at 15:20

1 Answers1

1

Hurray!! Finally I found the correct gitignore configuration:

#exclude everything from version control 
*/*

add desired directories to version control  
!a-V1.0.0/*
!a-V2-0-0/*
!a-V3-0-0/*

The problem was caused by the way, how I excluded all from tracking (gitignore line 2) and this small change does work as desired.

claus
  • 21
  • 2