-1

I am trying to switch to the mode where I exclude everything in line 1 of .gitignore and then include the files I really want to track. Here is my .gitignore file:

*
!*.py
!README.md
!vizing.pdf
!Data*

I can add the folder Data, but I really want Data and all it subfolders. When I try to add a subfolder, this happens:

> git add Data/EdgeColoring
The following paths are ignored by one of your .gitignore files:
Data/EdgeColoring
Use -f if you really want to add them.

I tried the suggestions to this question, but they didn't help much.

> git check-ignore -v Data/EdgeColoring
.gitignore:1:*  Data/EdgeColoring

I can't find another .gitignore file with a * pattern, so it seems that Data* doesn't match Data/EdgeColoring. Why is this? What is the right pattern?

Community
  • 1
  • 1
saulspatz
  • 4,309
  • 4
  • 28
  • 38

1 Answers1

0

Doing as git suggested in its response to you, I added the -f flag:

amber:IgnoreTest pjs$ touch Data/EdgeColoring/foo
amber:IgnoreTest pjs$ git status
On branch master

Initial commit

nothing to commit (create/copy files and use "git add" to track)
amber:IgnoreTest pjs$ git add Data/EdgeColoring
The following paths are ignored by one of your .gitignore files:
Data/EdgeColoring
Use -f if you really want to add them.
amber:IgnoreTest pjs$ git add -f Data/EdgeColoring
amber:IgnoreTest pjs$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

    new file:   Data/EdgeColoring/foo

amber:IgnoreTest pjs$
pjs
  • 16,350
  • 4
  • 23
  • 44
  • Thanks, I used the -f too. I'd like to have git track all the files in Data/ and it subfolders automatically, though. – saulspatz Apr 11 '15 at 23:25