I'm trying to view git bare repository tracked file in CLI on my local machine, similarly how they display on GitHub (or any other git hosting provider).
Example:
"Minimal", equivalent of tree --dirsfirst
:
.
├── src
│ ├── file-1
│ └── file-2
├── README.md
└── LICENSE
"Advanced", more like git hosting site, for example GitHub:
.
├── src commit-message-1 1 hour ago
│ ├── file-1 commit-message-1 1 hour ago
│ └── file-2 commit-message-2 8 days ago
├── README.md commit-message-3 year ago
└── LICENSE commit-message-3 year ago
It would need to be colored to make it more readable but I hope I get my point across.
"Extra advanced" example would be example 2 ("Advanced") but interactive where you could navigate directories like with lf or yazi.
I know I could just use tree
to achieve "minimal" example but I don't think I can use tree with git bare repository.
I know about git ls-files
but that doesn't render file list in tree
like view and I was hoping for more advanced view with commit messages, hashes and dates but even that would be something.
When searching for a solution, nearly all questions/answers I found were mentioning git ls-tree
which is not what I want.
git ls-tree
?git ls-tree
doesn't render a "tree" view liketree
does, it just a flat list,HEAD
, the simplest way is probably to create a worktree and browse that.