So I have a git project myproj
cloned into my system. When I add individually changed files for commit using git add .
it works fine. Now I have added a new folder new-folder
inside the project as myproj/app/scripts/new-folder
and want the new-folder
to add to my repository but git add .
or git add --all app/scripts/new-folder
or git add --all
do not work.

- 1,116
- 5
- 17
- 41
-
You can check this https://stackoverflow.com/questions/115983/how-can-i-add-an-empty-directory-to-a-git-repository/20388370#20388370 article – Slavi Galabov Aug 23 '18 at 06:37
2 Answers
I assume that you try to add an empty folder to your repository and this is currently not supported by git (check the git FAQ).
If this is the case then you find already some answers to your question on SO. For example see here. If you need an "empty" folder there are some "tricks" or "conventions", again see here or here.
If your folder is not empty, then a simple git add new-folder
should do the trick. This will also add all files within the folder.
If you do not see the non-empty folder as the result of git status
, you could also check if the folder name is not contained in your .gitignore
.

- 900
- 3
- 14
- 32
Make sure your new folder has something and run below git command
git add *
--> it will add all modifyed files and folders
Ex: you need to add new-folder to git you need go myproj then run git add * in Then it will simply include all folders and file in this path --> myproj/app/scripts/new-folder
But your new-folder should have some files

- 2,375
- 14
- 27