Hacker News new | past | comments | ask | show | jobs | submit login

For all the use cases I can think of, git worktree could be used to simulate this without any fuse dependency.



I did exactly this and use it as a "file system adapter" on my WordPress installation (to handle uploads/media). I tried to submit it as a plugin but they said "no" because I can't use "git" in the name -- and fuck that. So, I'm the only person on earth that does this (AFAIK).


Do you have this plugin available anywhere at all? I can't say it'd fit my workflow or anything without knowing more (so don't go out of your way!) but I'm very intrigued in to how it works


I'd like to use specific git tree object as a lowerdir for overlayfs mount, preferrably without requiring root. Do you have anything in mind for that?


Does worktree allow checking out the same branch but at different commits?


No, because a branch is a (re-assignable) name for some commit and cannot point at different commits while in the same repository at the same time. A "branch but at different commits" simply makes no sense. You can however create a worktree with a detached HEAD pointing at any commit. By default it seems to create a branch for each worktree.


Somewhat pedantic but relevant. A branch is a single commit. There aren't different commits _in_ a branch to checkout.

Regardless, if you are asking whether you can check out commit that doesn't have a branch pointing at it, yes you can.

You can have a work tree for every commit in your repository if you like.


You can have multiple work trees for the same commit, for that matter, as long as they are the same branch (so with different branches pointing at the same commit, or detached heads)


to be even more pedantic, a branch is a (named) pointer to a commit. You can have multiple names pointing to that commit.


TIL. Thx!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: