How to commit a directory into a git repository?

前端 未结 2 858
情话喂你
情话喂你 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 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"
    

提交回复
热议问题