emacs-devel
[Top][All Lists]
Advanced

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

Re: Obscure error/warning/information message from git pull


From: David Kastrup
Subject: Re: Obscure error/warning/information message from git pull
Date: Sun, 16 Nov 2014 10:23:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

> Hello, David.
>
> On Sat, Nov 15, 2014 at 03:35:35PM +0100, David Kastrup wrote:
>> Alan Mackenzie <address@hidden> writes:
>
>> > So "git clone" is defined in terms of "clone".  Looks like a recursive
>> > "definition" to me - part of what "git clone" does is to "clone[s] a
>> > repository".  There then follows an incoherent list of the form "does
>> > A, then does B, then does C, ...".
>
>> > What is missing is a definition of "clone".  It would appear to mean
>> > "make a partial copy of".
>
>> No.  Your copy is a complete copy of everything you ask for.  If you
>> don't clone a particular branch, for example, by using a single-branch
>> clone, that branch will not magically be in your repository.
>
> After a "git clone", the copy is not the same as the original.  In
> particular, branches are not preserved.

A local branch in the source directory becomes a remote branch in the
clone.  Remote branches in the clone are not exported.

> I don't know, as yet, what else fails to be copied, but I have no
> great confidence in the documentation to tell me.
>
> A branch foo in a repository degrades to remotes/origin/foo when that
> repository is "cloned", and, failing special action to save it,
> disappears altogether in a second generation "clone".
>
> Thus in my repository .../emacs-24, "cloned" from .../master, the
> emacs-23 branch is irretrievably lost.
>
> "git clone" makes a partial copy of a repository.  It does not
> duplicate it.  "Clone", as a verb, means "duplicate"; it never means
> "truncate".

If you do not want the upstream of the clone to be the original, then
use

git clone --mirror

> I chose to clone a repository.  git did not do this for me.

You'll find that creating a biological clone of you does not give an
identical twin either.  Different age, different descendency.  If you
want a replication, use git clone --mirror.

>> Nonsense.  _Everything_ you asked for is stored on your computer.
>> Git does not maintain any data off-computer.
>
> This is confusing.  Is it the case that branches labelled
> "remotes/origin/..." are completely contained within the same
> repository?

Yes.  You can create a local branch from them using

git checkout -b mywhatever origin/branchname

and then work on that branch, looking at its history, without once going
online.  If it's there at all, it is filled in.

You cannot _commit_ to such remote-tracking branches stored on your
computer.  If you check them out, you just get a detached HEAD if you
don't create a local branch tracking the remote.  You can commit to a
detached HEAD but that does not touch your remote branch information.
There are only two ways to update the remote branch information: either
by fetching.  _Or_ by successfully _pushing_ to the corresponding
repository in which case Git also updates its idea of it.

> Is there anywhere in the git documentation, or elsewhere, which lists
> what entities are preserved by "git clone", and which ones are deleted
> or modified?

I'd try

    man git-clone

or

    git clone --help

-- 
David Kastrup




reply via email to

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