[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: git: how to restore a deleted worktree?

From: Nathan Moreau
Subject: Re: git: how to restore a deleted worktree?
Date: Thu, 4 Jan 2018 15:07:54 +0100

It's not clear what you did when you `deleted' the worktree. The
proper way to cleanup worktrees is
+ first to remove the associated branch (emacs-26)
+ then `git worktree prune'.

This is probably what you need to do to get back to a clean state in
your case, before going to `git worktree add....' again.
If you just run the prune command, git won't prune anything as the
branch still exists.

On 4 January 2018 at 14:51, Stephen Leake
<address@hidden> wrote:
> I have the emacs-26 branch checked out in a worktree created by :
> cd emacs/master
> git worktree add -b emacs-26 ../emacs-26 origin/emacs-26
> At some point, that worktree was in a confusing state, so I deleted it,
> intending to do a fresh checkout. So I repeated the above command, but
> it complained "branch emacs-26 already exists". So I dropped the '-b
> emacs-26', and the command seemed to work.
> However, 'git status' in the new worktree says "not on any branch",
> 'git push' complains about fast-forward, and 'git pull' says not on a
> branch.
> How do I fix this?
> --
> -- Stephe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]