Re: Deleting remote branch pointed by remote HEAD

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

 



* Michael J Gruber [Wed, 21 Jan 2009 15:33:36 +0100]:

> Marc-André Lureau venit, vidit, dixit 21.01.2009 14:02:
> > Hi

> > I deleted a remote branch which was pointed by HEAD, this way: "git
> > push origin :master"

> > Then for almost every git command, I get this error: "error:
> > refs/remotes/origin/HEAD points nowhere!".

> You're talking about about the remote git repo, aren't you?

> > I found this situation non-friendly. Fortunately, I could understand
> > what's going on. But a new user might be confused.

> > Shouldn't the remote HEAD branch be updated or "protected" in some
> > ways? Or should the "error" be considered as a "warning" (silently?)

> > What do you think?

> I think that git said
> "warning: updating the currently checked out branch; this may cause
> confusion,
> as the index and working tree do not reflect changes that are now in HEAD."
> after your push and that this may have rung some bells. I also think
> that pushing to a non-bare remote repo (one with a worktree checked out)
> is strongly advised against in multiple places, unless you know what
> you're doing - which you seem to do since you were able to restore your
> HEAD ;)

I don't think Marc-André was pushing to a non-bare repo, but it doesn't
really matter, because his issue also shows up with bare repos: if you
delete the branch to which HEAD points in a remote repo, you get no
warning, and then cloning that bare repo does not fully work, because
its HEAD points to a non-existent ref.

    % g clone ssh://.../foo.git
    % cd foo
    % g push origin :master
    % cd ..
    % g clone ssh://.../foo.git foo2
    ...
    warning: remote HEAD refers to nonexistent ref, unable to checkout.

What would git usefully do in this situation, I don't know. But I
thought I'd clear up the above confusion.

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
Truth is the most valuable thing we have, so let's economize it.
                -- Mark Twain

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux