unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: git: how to restore a deleted worktree?
Date: Thu, 04 Jan 2018 13:29:44 -0500	[thread overview]
Message-ID: <jwvlghd7a6a.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: 86wp0x3f7c.fsf@stephe-leake.org

> 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




      parent reply	other threads:[~2018-01-04 18:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04 13:51 git: how to restore a deleted worktree? Stephen Leake
2018-01-04 14:06 ` Noam Postavsky
2018-01-04 22:04   ` Stephen Leake
2018-01-04 23:14     ` Andreas Schwab
2018-01-04 14:07 ` Nathan Moreau
2018-01-04 22:07   ` Stephen Leake
2018-01-07 20:15     ` Nathan Moreau
2018-01-07 20:22       ` Andreas Schwab
2018-01-04 14:49 ` Andreas Schwab
2018-01-04 18:29 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvlghd7a6a.fsf-monnier+gmane.emacs.devel@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).