has anyone made a read-only FUSE filesystem for a git repository where every commit is a folder and the folder contains all the files in that commit?

the idea is that you could just run `cd COMMIT_ID` and poke around instead of checking out the commit

and maybe the branches could be symbolic links to the commit folders?

guys this is such a fun idea I cannot believe people are in the replies trying to explain to me why they think it is impractical

the whole point of computers is to do impractical things and see what happens

seems like the answer is yes!

- https://github.com/fanzeyi/giblefs (fuse implementation in rust where every commit is a folder)
- https://orib.dev/git9.html (for plan 9)

would love to hear about any others

GitHub - fanzeyi/giblefs: Mapping a Git repository as a virtual filesystem

Mapping a Git repository as a virtual filesystem. Contribute to fanzeyi/giblefs development by creating an account on GitHub.

GitHub

ok I got extremely nerd sniped and made my own version of this “filesystem where every git commit is a folder" thing https://github.com/jvns/git-commit-folders

I wrote a FUSE version and an NFS version that I think will be easier for mac users to use. it definitely does not work on windows.

it probably has about 5 million bugs but it seems to kind of work

GitHub - jvns/git-commit-folders

Contribute to jvns/git-commit-folders development by creating an account on GitHub.

GitHub

the main reason I've found this "all your git commits are folders" feature to be useful is for searching past code: I can run `grep someFunction branch_histories/main/*/commit.go` to find the old version of someFunction I deleted. There are other ways to do that in git but this is easier.

or if I want to just quickly look at a file on another branch to copy a line from it, I can run `vim branches/other-branch/go.mod`

curious about other use cases

(from https://github.com/jvns/git-commit-folders)

GitHub - jvns/git-commit-folders

Contribute to jvns/git-commit-folders development by creating an account on GitHub.

GitHub
@b0rk That reminds me of a use case I struggle with in git that I used all the time in Perforce: what the P4V GUI Perforce client calls “Time-Lapse View.” Open a file in time-lapse view and you see the file contents plus a slider at the top that will take you through all revisions of the file, changing the displayed content as you slide it around. The way Perforce handles file revisions makes this straightforward, but this is less true in git. Most git GUI clients don’t have this feature at all.
@siracusa that's interesting, it doesn't seem to me like there's anything about the design of git that would make that hard to implement

@b0rk Perforce’s use of increasing revision numbers for files makes it an easy fit for the ussr’s mental model: “The latest revision is 5, but I want to see revisions 4, 3, 2, and 1.” The way Perforce handles branching also fits: different paths for each branch, so branch-a/file has a different set of revision numbers than branch-b/file.

I’m not sure how best to map a “revision slider” to users’ various mental models of git.

@siracusa what i'm doing in my commit folders project (which is kind of silly but sort of works) is numbering the revisions backwards -- so you have branch_history/main/0, branch_history/main/1, etc. 0 is the latest and the other numbers are relative

the numbers wouldn't be stable, but you can say something like “as of 912da3150d9cfa74523b42fae028bbb320b6804f, 5 versions ago”

@b0rk Hah, makes sense! I guess that concept already exists in the git CLI in the form of things like HEAD~N.
@siracusa @b0rk for me as a sporadic GUI only git user (for small, not that messy code bases and some git scraping), I’ve used sites like this one to accomplish that: https://githistory.xyz/
Git History

Quickly browse the history of a file from GitHub, GitLab, Bitbucket or any git repository

@aronambrosiani @siracusa i'd never seen this, this is great
@b0rk @siracusa there's also another site I've used specifically for viewing git scraped json data, makes interactive tables: https://flatgithub.com/
@aronambrosiani @b0rk @siracusa giving websites access to source code is a non-starter for many companies.