Git directory structure confusion

Based on the svn background, although not such an advanced user, I got confused about the git directory structure.

For a C ++ project, I read the first 3 chapters of the pro git book, which is online. I guess this is a pretty good book with a lot of numbers that make the explanation easier.

Now the question is that svn created the trunk directory, in which my header and source codes were specified (more precisely, I created them using the svn commands), the include and src directories. In the first three chapters and after that I did not see such a structure. The question is, what is the best strategy for structuring your work in such directories should create different directories and separately add files in these directories to control tracking, or is there a more structured way to do this as a whole?

I think I don’t need to keep everything in one place, which is unlikely ...

+4
source share
3 answers

You can use any folder structure you want.

If you want to have

myproject |-- src |-- include 

it's good. Of course, you should not keep everything in one place.

The only thing (if myproject is your repo root), you will have a .git folder where your repo data is stored:

 myproject |-- .git |-- src |-- include 

Unlike .svn folders in each folder of a working copy of SVN, Git uses only one folder to track repos.

+8
source

svn has no real tags and branches, all this is just a copy of another file or folder. git supports real branches and does not need a directory structure like svn. just create the directory structure you need for your project. For branching and tagging, use git branch and git tag respectively (unlike the subversion svn copy )

+7
source

git gives a clear difference between the contents of the revision (files located in the directory tree), as well as the history of changes and your branches.

Thus, a typical git user will not create directories such as trunks and branches. One message really contains only files related to this revision. All this is up to your content, the git book will recommend what it should look like.

To look at the change history, use the gitk tool.

Of course, if you really want to, you can create directories for trunks, branches, etc. git will not complain. SVN users can enjoy seeing such repos, git users are probably not many.

+3
source

All Articles