emacs-devel
[Top][All Lists]
Advanced

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

Re: git: how to restore a deleted worktree?


From: Stefan Monnier
Subject: Re: git: how to restore a deleted worktree?
Date: Thu, 04 Jan 2018 13:29:44 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> git worktree add -b emacs-26 ../emacs-26 origin/emacs-26
[...]
> 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", 

So you did:

    git worktree add ../emacs-26 origin/emacs-26

which means "give me a worktree that shows the content of the remote
branch origin/emacs-26".  So it indeed didn't use any (local) branch for
that, and instead used a "detached head" (IIRC the terminology used by
Git).

You could have used

    git worktree add ../emacs-26 emacs-26

since you apparently already had a local `emacs-26` branch (which
presumably tracks the remote origin/emacs-26).

But as Andreas explains, it's easy to fix without a new "git worktree":
just do `git checkout emacs-26`.


        Stefan




reply via email to

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