简体   繁体   中英

Is git best practice to version a top-level directory?

If I create a git repository, is it best to have a single top directory (with the project name)

root
|- project
   |- foo.c
   |- baz.S
|- readme.md

or is it better to version the contents of a top directory at the root?

root
|- foo.c
|- baz.S
|- readme.md

Or does it not matter?

I think the most common approach is to have the root of your repository be the root of your project

root
|- file1
|- file2

But in some cases it would make sense to wrap your project files in another directory to separate them from meta/config files. For example if you were working on a web page:

root
|- project
   |- index.html
   |- script.js
|- readme.md

It just comes down to your own preferences and requirements. Whatever looks right.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM