1

Only folders exists in the parent and the subfolders. I've deleted all files using:

find my-path-here -type f -delete

example setup:

parent-path (this is parent folder for the repo)
  -> subfolder1
  -> subfolder2
  -> subfolder14
  -> subfolder67

I tried adding and commiting this setup but git is not adding the subfolders. I've searched the net but didn't see anything useful other than using "git add --all"

Here's my terminal output:

parent-path on  master 
➜  rm -rf .git

/home/myuser/parent-path 
➜  git init  
Initialized empty Git repository in /home/myuser/parent-path/.git/

parent-path on  master 
➜  git add .                                                                  

parent-path on  master 
➜  git add --all

parent-path on  master 
➜  git add "subfolder1"

parent-path on  master 
➜  git commit -av -m "initial commit"                                         
On branch master

Initial commit

nothing to commit

parent-path on  master 
➜  git status                        
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)

parent-path on  master 
➜  ls -la .gitignore

   Specified path '.gitignore' doesn't exist.

parent-path on  master 
➜ 
Liam
  • 27,717
  • 28
  • 128
  • 190
mrjayviper
  • 2,258
  • 11
  • 46
  • 82
  • 3
    git does not track empty directories. If there are no links in the directory, it will be ignored. – William Pursell Aug 06 '19 at 14:45
  • 1
    GIT does not track directories **at all**. GIT only tracks files. So an empty directoy contains no files, so it's not tracked – Liam Aug 06 '19 at 14:47

1 Answers1

1

You have to add a .gitkeep file to each directory you want under version control

Guillermo Mansilla
  • 3,779
  • 2
  • 29
  • 34