Re: Worktree silently deleted on git fetch/gc/log
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 1, 2018, 20:14 UTC
- Message-ID
- <CAPig+cTPFSbT7WxyoNEOSg=3Ft1pVzkgieGp44kHnZ9=NbYsqg@mail.gmail.com>
- In-Reply-To
- <adf7a7a0-3571-5b68-5d15-30a9067e3826@aegee.org>
On Thu, Mar 1, 2018 at 2:24 PM, Дилян Палаузов <dilyan.palauzov@aegee.org> wrote:
> /git/A/.git/worktrees/b/ is missing - that is the point. > /git/B/,git wasn't modified since the worktree was created, cat: > gitdir: /git/A/.git/worktrees/b
I'll assume that the lowercase 'b' was a typo in your email (as it was in mine), and that the real content is "gitdir: /git/A/.git/worktrees/B".
You should be able to get back to a working state like this:
% cd /git/A/ % mkdir -p .git/worktrees/B % echo 'ref: refs/heads/g' >.git/worktrees/B/HEAD % echo ../.. >.git/worktrees/B/commondir % echo /git/B/.git >.git/worktrees/B/gitdir
% cd /git/B/ % git reset
As far as I know, there isn't any code in Git which would automatically remove the .git/worktrees/B directory, so it's not clear how that happened.