Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a tree and a directory?

I am a git novice trying to sort through the concepts and terms. The git glossary says a tree is equivalent to a directory and a directory is what you get with ls. Are they interchangeable terms? Or are "tree" and "directory" to be used in different contexts or to refer to separate (though related) things?

like image 627
user7797 Avatar asked Jun 04 '11 03:06

user7797


People also ask

Is a directory a tree?

Structure. The directory is structured in the form of a tree. It also has a root directory, and every file in the system has a unique path. A directory within a tree-structured directory may contain files or subdirectories.

Is working tree the same as working directory?

There is a subtle difference in meaning. A directory is a singular thing -- a folder, a collection of files -- whereas a working tree means a tree like structure of files and directories that are collectively referenced.

What is folder directory tree?

A directory tree is a hierarchy of directories that consists of a single directory, called the parent directory or top level directory, and all levels of its subdirectories (i.e., directories within it).

What is a directory tree file?

A directory structure/system/tree is simply a layout of directories on your computer. Taking a big step back, the early computer designers realized that lumping together every single file on your computer would create a massive jumble and make it impossible to find anything. So they wisely created the directory.


1 Answers

The short answer: yes, a tree is a directory and a directory is a tree.

The long answer: A tree is an object that contains a list of blobs, the names to attach to the blobs, and other trees and the names to attach to them. http://book.git-scm.com/1_the_git_object_model.html has a pretty good explanation of the different object types in the git model; I would suggest reading it!

like image 74
clee Avatar answered Oct 16 '22 18:10

clee