Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git directory structure confusion

Tags:

git

Coming from an svn background, although not a that advanced user, I had a confusion on the directory structure of git.

For a C++ project, I read the first 3 chapters of the book pro git which is online. I guess that it is a pretty good book with lots of figures that ease explanations.

Now the question is that svn was creating a trunk directory under which my header and source codes were located namely(more precisely I was creating them with svn commands), the include and src directories. In the first 3 chapters and thereafter I did not see a structure like this. Question is that what is the best strategy to structure your work under directories like this, should create different directories and add the files under these directories separately to tracking control or is there a more structured way to do this as a whole?

I guess I do not have to keep everything in one place, which is highly unlikely...

like image 485
Umut Tabak Avatar asked Dec 03 '22 01:12

Umut Tabak


2 Answers

You can use any folder structure you want.

If you want to have

myproject
  |-- src
  |-- include

that's fine. You do (of course) not have to keep everything in one place.

The only thing is that (assuming myproject is your repo's root) you will have a .git folder there where your repo data is stored:

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

Unlike the .svn folders in every folder of an SVN working copy, Git uses only this one folder to keep track of the repo.

like image 112
eckes Avatar answered Dec 23 '22 06:12

eckes


svn does not have any real tags and branches, everything is just a copy of another file or folder. git supports real branches and does not need a directory structure similar to svn. simply create the directory structure required for your project – for branching and tagging use git branch and git tag respectively (as opposed to subversion's svn copy command)

like image 41
knittl Avatar answered Dec 23 '22 05:12

knittl