Alexander Bird
Alexander Bird

Reputation: 40619

git first number in ls-tree output

Whenever I run git ls-tree, the first number in every line is 100644. What does this number mean, and is it really always that number every time?

The only guess I have is that it's a number for some future compatibility reasons.

--EDIT--

I misread the manual. It turns out that the first number is the mode. So I guess my question is what does mode mean? (file permissions?)

Upvotes: 2

Views: 258

Answers (1)

Adam Byrtek
Adam Byrtek

Reputation: 12202

Those are Unix filesystem permissions in octal notation. The first three digits denote the file type (100 means directory), and the following three digits represent permissions for the owner, the owning group, and everybody else (respectively).

The following basic permissions can be combined:

  • 1 (--x): execute
  • 2 (-w-): write
  • 4 (r--): read

In other words 644 means "read and write for the owner, read-only for the rest".

Upvotes: 4

Related Questions