Live data from Hacker News

Mounting Git commits as folders with NFS

jvns.ca

31–40 of 95 posts

Re: Mounting Git commits as folders with NFS

#31
post #22

I just hate these things where people use the terms "folder" and "directory" as if they were the same thing. They are not and I wish some people would wise up to that. Yes. This is a pet peeve of mine.

Please don't just rant about it, but explain, or link to an explanation, the difference so others can see if there's actually a substantial difference.

> Please don't just rant about it, but explain, or link to an explanation, the difference so others can see if there's actually a substantial difference.

Fairly easy to look up and I just did , https://stackoverflow.com/questions/5078676/what-is-the-diff... but I agree , comments like this come across as smug and unhelpful. A few short lines explaining and a link would have been much helpful and greatly improves the quality of discussion on this site.

Re: Mounting Git commits as folders with NFS

#32
post #6

For those who resonate with "why might this be useful", here are "plain git" alternatives to this tool: > searching for a function I deleted git log -G someFunc > quickly looking at a file on another branch to copy a line from it I use `git worktree` to "mount" long-running branches much to the same effect as Julias tool. To quickly look at a file from a non-mounted branch/commit, I use: git show $REF:$FILENAME > sea…

If you’re a Vim user, fugitive by tpope is a great tool

Re: Mounting Git commits as folders with NFS

#34
post #6

For those who resonate with "why might this be useful", here are "plain git" alternatives to this tool: > searching for a function I deleted git log -G someFunc > quickly looking at a file on another branch to copy a line from it I use `git worktree` to "mount" long-running branches much to the same effect as Julias tool. To quickly look at a file from a non-mounted branch/commit, I use: git show $REF:$FILENAME > sea…

Magit has a really easy to use way to "step" through previous versions of files. It's usually bound to something like "C-f p". You get a read only buffer of the previous version open in the best text editor (emacs). You can then press n and p to step through next and previous versions of that file. Can be pretty useful! It's kind of funny, I think, how most git users don't seem to know how to access any version other…

Similarly with fugitive in vim, which is fantastic. Diffing, resolving conflicts, and moving through file revisions (and a lot more).

Re: Mounting Git commits as folders with NFS

#36

Earlier quoted context omitted.

Magit has a really easy to use way to "step" through previous versions of files. It's usually bound to something like "C-f p". You get a read only buffer of the previous version open in the best text editor (emacs). You can then press n and p to step through next and previous versions of that file. Can be pretty useful! It's kind of funny, I think, how most git users don't seem to know how to access any version other…

That’s a pretty cool feature of Magit. I was inspired to look for something similar for the next best text editor (vim) and came across this: https://salferrarello.com/using-vim-view-git-commits/ git log | vim -R - Placing your cursor over a commit hash and entering K displays git show for that commit.

If you're not using neovim you're really missing out right now IMO. It's a renaissance for a hackable text editor because it uses a sensible modern programming language (Lua) rather than vimscript (yikes) or elisp (eh).

Re: Mounting Git commits as folders with NFS

#37
post #5

> Git repositories sometimes have submodules. I don’t understand anything about submodules so right now I’m just ignoring them. Submodules are interesting, because they’re next to unusable from a user perspective (they’re a pain to maintain and interact with unless you never ever update them) but they’re ridiculously simple technically which I assume is what made them attractive. A submodule is an entry in “.gitmodul…

Git submodules can be useful for vendoring internal parts without code duplication. It can help you if the tech you are writing the code in that repo doesn't have any specific/advanced tool for dependency management. By using `git checkout --recurse-submodules` you have a poor-man version of a package system.

I'm not endorsing it as the best feature ever or as the way to do dependency management but it can be used in certain situations.

Re: Mounting Git commits as folders with NFS

#38

Is there a project that does the reverse of this, namely mounting a filesystem where every write to a file in the repository becomes a Git commit?

You mean like when nothing has the file open any more, or doing a commit with every flush to disk? I think the latter is a bit excessive.

One of the FUSE implementations mentioned in this post may do something like that.

Re: Mounting Git commits as folders with NFS

#39
post #4

Reminds me of Rational ClearCase, which probably inspired the idea. You could specify a "view" using tags, and it'd present it as a filesystem to remote machines. I think IBM now own them.

Clearcase also had version extended naming so you could access a specific revision as sort.c@@/main/bugfix/4 or tag as sort.c@@/RLS_1.3

Re: Mounting Git commits as folders with NFS

#40

Is there a project that does the reverse of this, namely mounting a filesystem where every write to a file in the repository becomes a Git commit?

I have been looking for that as well. Some sort of 'implicit versioning', a bit like how version history works for Google Docs [1], but instead for the filesystem.

[1] https://support.google.com/docs/answer/190843

Post reply on HN