[Top][All Lists]

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

Re: git: how to restore a deleted worktree?

From: Noam Postavsky
Subject: Re: git: how to restore a deleted worktree?
Date: Thu, 4 Jan 2018 09:06:35 -0500

On Thu, Jan 4, 2018 at 8:51 AM, Stephen Leake
<address@hidden> wrote:

> 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".

You need 'git worktree prune' to make git remove the bookkeeping info
about that deleted worktree (possibly you have delete your new tree
first, not sure how pruning works when you've recreated a new worktree
in the same place).

git help worktree:

    When you are done with a linked working tree you can simply delete
    it. The working tree’s administrative files in the repository (see
    "DETAILS" below) will eventually be removed automatically (see
    gc.worktreePruneExpire in git-config[1]), or you can run git
    worktree prune in the main or any linked working tree to clean up
    any stale administrative files.

reply via email to

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