T
T
Timebird2019-07-24 17:29:56
git
Timebird, 2019-07-24 17:29:56

How to commit subfolder files in Git?

Good afternoon,
Let's say I have the following structure:
file1
Folder1
--file1
Folder2
--Subfolder1
----file1
----file2
How can I commit all files, including those in subfolders?
Git creates folders (including those on github), but leaves them empty.
Tried the default:

git clone https://...
<Добавляю папки с файлами в склонированный репозиторий>
git add .
git commit -m "Добавил папки"
git push origin <branch_name>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lorc, 2019-07-24
@lorc

This is surprising because git doesn't actually know how to commit empty directories. There must be at least one file.
If you want to commit everything at all - do git add .(pay attention to the dot) before git commit.
And make sure your .gitignore doesn't make git ignore new files.

I
Ivan Shumov, 2019-07-24
@inoise

git add --allif vlob

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question