Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does git, for example, create the database they use?

Hi so I am working on a terminal application and would like to use a database. I am not sure the best way to go about doing it though.

So I want to have the program be able to install like you would git or with brew install etc. And then each person that installs it would have their own database which will be accessed via certain commands.

I'm just not sure what the best way to do this would be? I was thinking for each entry I would put in the database I could just create a file in a .directory?

Thanks.

like image 209
Jonovono Avatar asked Jan 17 '23 16:01

Jonovono


1 Answers

The filesystem is actually quite a good database, suitable for storing a moderate number of documents with sizes ranging from tiny to huge. It's not relational (the only "key" is the file name), and it's actually closer to a "NoSQL" database than a relational database.

The Git database, in fact, can store all its objects with one object per file. However, for efficiency reasons, it was found that the access patterns required by Git were better served by combining many objects into one "pack" file.

like image 50
Greg Hewgill Avatar answered Jan 19 '23 07:01

Greg Hewgill