How to commit a directory into a git repository?

前端 未结 2 856
情话喂你
情话喂你 2020-12-16 11:32

I read the great git tutorial here, I\'m unable to create directories.

My folder structure is:

Code - Python - C++ - F# - ...

From withi

相关标签:
2条回答
  • 2020-12-16 11:52

    Git won't commit empty directories. There must be files in the directories first.

    0 讨论(0)
  • 2020-12-16 12:01

    Try to add some files to directories first. You can add some dummy file to directory, and remove that file when you have added the actual content for the directory.

    Git does not track empty directories, it tracks files and their contents.

    git init
    mkdir foo
    touch foo/dummy_empty_file
    
    git add foo
    git add foo/dummy_empty_file
    git commit -m "adding files"
    
    0 讨论(0)
提交回复
热议问题